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
Shape-inference does not handle variants of Constant op introduced in opset 12. The opset 12 version introduced the ability to specify constant values using one of multiple attributes (like value_ints, for example) but the implementation handles only the original form (using the attribute value).
Reproduction instructions
Describe the code to reproduce the behavior.
from onnx import shape_inference, parser
def infer(x):
model = parser.parse_model(x)
inferred_model = shape_inference.infer_shapes(model)
return { vi.name : vi.type for vi in inferred_model.graph.value_info }
result = infer('''
<
ir_version: 7,
opset_import: [ "" : 15 ]
>
toy (int64[?] X) => (int64[] Y)
{
S = Constant <value_ints = [10, 20]>()
Z = Reshape (X, S)
Y = Identity (Z)
}
''')
print(result['Z'])
result2 = infer('''
<
ir_version: 7,
opset_import: [ "" : 15 ]
>
toy (int64[?] X) => (int64[] Y)
{
S = Constant <value = int64[2] {10, 20}>()
Z = Reshape (X, S)
Y = Identity (Z)
}
''')
print(result2['Z'])
Bug Report
Describe the bug
Shape-inference does not handle variants of Constant op introduced in opset 12. The opset 12 version introduced the ability to specify constant values using one of multiple attributes (like
value_ints
, for example) but the implementation handles only the original form (using the attributevalue
).Reproduction instructions
Expected behavior
Both
result
andresult2
should have same valueNotes
This line needs to be fixed:
onnx/onnx/shape_inference/implementation.cc
Line 341 in f0c4ee2
The text was updated successfully, but these errors were encountered: