Commit c79caf0
authored
[Relax][ONNX] Complete ShapeExpr reshape handling in ONNX frontend (#18956)
## Summary
Complete `Reshape` handling for shape values in the Relax ONNX frontend.
## Changes
- keep `ShapeExpr -> Reshape([-1])` on the shape-specialized path
- materialize `ShapeExpr` to an `int64` tensor for other reshape targets
and apply regular tensor reshape semantics
- add frontend coverage for `Shape -> Reshape([-1])`
- add frontend coverage for reshaping shape outputs to non-`[-1]`
targets such as `[1, 3]` and `[3, 1]`
- extend symbolic shape deduction coverage to include the common `Shape
-> Reshape([-1]) -> Gather -> Unsqueeze` shape-construction pattern
## Validation
- `pytest -k 'test_symbolic_shape_deduction or test_reshape_shape_output
or test_reshape'`
This PR completes the `Reshape` limitation in the Relax ONNX frontend
operator work tracked in #18945.1 parent cb5e290 commit c79caf0
2 files changed
Lines changed: 63 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1016 | 1016 | | |
1017 | 1017 | | |
1018 | 1018 | | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
1024 | 1029 | | |
1025 | 1030 | | |
1026 | 1031 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
974 | 1006 | | |
975 | 1007 | | |
976 | 1008 | | |
| |||
3630 | 3662 | | |
3631 | 3663 | | |
3632 | 3664 | | |
3633 | | - | |
| 3665 | + | |
| 3666 | + | |
3634 | 3667 | | |
3635 | 3668 | | |
3636 | 3669 | | |
3637 | 3670 | | |
3638 | 3671 | | |
3639 | 3672 | | |
3640 | 3673 | | |
3641 | | - | |
| 3674 | + | |
| 3675 | + | |
| 3676 | + | |
| 3677 | + | |
| 3678 | + | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
| 3682 | + | |
| 3683 | + | |
| 3684 | + | |
3642 | 3685 | | |
3643 | 3686 | | |
3644 | 3687 | | |
3645 | 3688 | | |
3646 | 3689 | | |
3647 | 3690 | | |
3648 | 3691 | | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
3649 | 3698 | | |
3650 | | - | |
| 3699 | + | |
3651 | 3700 | | |
3652 | 3701 | | |
3653 | 3702 | | |
3654 | 3703 | | |
3655 | | - | |
| 3704 | + | |
3656 | 3705 | | |
3657 | 3706 | | |
3658 | 3707 | | |
| |||
0 commit comments