viiccwen opened a new pull request, #19992: URL: https://github.com/apache/tvm/pull/19992
### What changed Record the original input rank before `Expand` left-pads the input shape for broadcast validation. The no-op fast path now returns the input unchanged only when both the padded shape and the original rank match the target. A regression test covers expanding `[1]` to `[1, 1]` when the target is represented as a Relax `ShapeExpr`. ### Why ONNX `Expand` right-aligns dimensions and may increase tensor rank by adding leading dimensions. Previously, a rank-expanding broadcast could look like a no-op after the frontend padded the input shape, causing it to return the original lower-rank tensor. Downstream operators could then receive inconsistent ranks. This fixes the focused bug tracked in #19991 and is part of the investigation and fixes for #19971. It does not close #19971 because the attached model exposes additional independent importer issues after this `Concat` failure is resolved. Fixes #19991 Part of #19971 ### Validation - `python -m pytest tests/python/relax/test_frontend_onnx.py::test_expand -q` - `pre-commit run --files python/tvm/relax/frontend/onnx/onnx_frontend.py tests/python/relax/test_frontend_onnx.py` - A/B checked the model attached to #19971: the base revision reproduces `Concat expects all input tensors to have same ndim`, while this change advances beyond that `Concat`. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
