viiccwen opened a new issue, #19991:
URL: https://github.com/apache/tvm/issues/19991
### Expected behavior
ONNX `Expand` should preserve the requested output rank. Expanding an input
with shape `[1]` to target shape `[1, 1]` should produce a rank-2 tensor.
### Actual behavior
The Relax ONNX frontend left-pads the input shape while checking broadcast
compatibility. When the padded input shape equals the target shape, its no-op
shortcut can return the original, unpadded input.
For example, `[1]` is padded to `[1, 1]` for validation, but returning the
original tensor keeps rank 1 instead of producing rank 2. A downstream
`Unsqueeze` and `Concat` can then fail because sibling tensors have different
ranks.
### Minimal pattern
```text
input: float32[1]
shape: int64[2] {1, 1}
Expand(input, shape) -> float32[1, 1]
```
### Root cause
The no-op check compares the target shape against the padded input shape
without also checking the original input rank. Rank expansion still requires a
broadcast even when all padded dimensions are equal.
This was identified while investigating #19971.
--
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]