You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: rewrite Conv nodes, but only with dilations==[1,1]. Issue - default value. To check dilation, I need include it in pattern, but this cause pattern match to fail on nodes with default dilations.
Thanks. So a node with default and without default is store differently in graph. They are semantically the same but syntactically different. We need to decide what the behavior of the matcher should be.
Well, it can be outside of matcher, if one could force defaults for node.
But as I found, it may be not formalized at all!
from onnx import helper, reference
schema = reference.op_run.get_schema('Conv', 15)
if schema.attributes:
for _, attr in sorted(schema.attributes.items()):
default_value = helper.get_attribute_value(attr.default_value)
print(f'{attr.name=:20}{default_value=}')
attr.name='auto_pad'
default_value=b'NOTSET'
attr.name='dilations'
default_value=None
attr.name='group'
default_value=1
attr.name='kernel_shape'
default_value=None
attr.name='pads'
default_value=None
attr.name='strides'
default_value=None
onnx.reference.op_run.get_schema('Conv', 11).attributes['dilations']
OpSchema.Attribute(name='dilations', type=<AttrType.INTS: 7>, description='dilation value along each spatial axis of the filter. If not present, the dilation defaults is 1 along each spatial axis.', default_value=, required=False)
I wonder, how it handled in onnxruntime, just hardcoded?
I would rather put defaults handler outside of matcher, with function like force_defaults(node) =>node, forced keys probably paired with strip_defaults
Problem: rewrite
Conv
nodes, but only withdilations
==[1,1]. Issue - default value. To check dilation, I need include it in pattern, but this cause pattern match to fail on nodes with default dilations.Probably related: #1627
Possible fix: substitute defaults on deserialization, I suspect, such a function already exists.
rewr_c.py.txt
The text was updated successfully, but these errors were encountered: