[Relax][ONNX] Update ReduceL1 to opset 18 #18072
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR resolves #18032 where a valid onnx model causes an error in TVM but not in onnxruntime.
Why the error occurs
axes
is passed as an input rather than an attributeReduceL1-13
receives aNone
axes and reduces all dimensions to size 1.DepthToSpace
, dimension size(1) // block size(2) yields zero. As a resultmanipulate.cc:860
becomes false and an error is triggered atmanipulate.cc:865
.Anyway in summary, the error occurs because of the updated ReduceL1.
Changes
Differences vs opset<18:
axes
is now an input instead of an attribute.noop_with_empty_axes
To do
relax.op.max/min/sum
, etc) in TVM currently support only constant axesImplementation in TVM
The official ONNX spec ambiguously describes "empty axes" — it’s unclear whether it refers to
None
or to an empty list[ ]
. However, the "Inputs" section states there can be one or two inputs and that axes is optional, thus I think interpreting "empty axes" as eitherNone
or[ ]
aligns with the specification.Notes on a bug in ONNX Runtime
Opened issue microsoft/onnxruntime#25095
[ ]
1
[ ]
0
None
1
None
0