vacu9708 opened a new pull request, #18072:
URL: https://github.com/apache/tvm/pull/18072

   # Summary
   This PR resolves https://github.com/apache/tvm/issues/18032 where a valid 
onnx model causes an error in TVM but not in onnxruntime.
   **Why the error occurs**
   1. `axes` is passed as an input not an attribute, starting from ReduceL1-18
   2. Therefore, `DepthToSpace` receives a "None" axis
   3. As a result, DepthToSpace receives a None axis and reduces all dimensions 
to size 1.
   4. Dividing the dimension size by the block size yields zero, causing 
manipulate.cc:860 to be false and triggering an error at manipulate.cc:865.
   
   Anyway in summary, the error occurs because of the updated ReduceL1.
   
   # Changes
   - Update ReduceL1 from opset 13 to opset 18.
   - Add corresponding test cases to cover the new behavior.
   
   **Differences vs opset<18:**
   - `axes` is now an input instead of an attribute.
   - Introduces attribute noop_with_empty_axes:
     - No `axes` input && `noop_with_empty_axes`=0 -> reduce over all 
dimensions.
     - No `axes` input && `noop_with_empty_axes`=1 -> return the input 
unchanged.
     - `axes` provided -> reduce over the specified axes.
   
   # To do
   All other reduce ops have changed the same way and need to be updated 
accordingly
   
   # Notes on a bug in ONNX Runtime
   - Empty axes list `[ ]` && noop_with_empty_axes=1 -> **Correctly returns 
input unchanged**
   - Empty axes list `[ ]` && noop_with_empty_axes=0 -> **Correctly reduces all 
dimensions**
   - Omitted axes list `None` && noop_with_empty_axes=1 -> **raises a runtime 
error**
   - Omitted axes list `None` && noop_with_empty_axes=0 -> **Correctly reduces 
all dimensions**
   
   [official onnx spec](https://onnx.ai/onnx/operators/onnx__ReduceL1.html) 
ambiguously describes "empty axes". It’s unclear whether it refers to `None` or 
to an empty list `[ ]`. But the "Inputs" section clearly states "Between 1 and 
2 inputs" and "axes is optional", thus I think interpreting "empty axes" as 
either `None` or `[ ]` aligns with the specification.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to