Commit 0cd3c80
committed
_aten_to_core: extend replace_cat dynamic-axis promotion to handle still-dynamic siblings
The previous replace_cat fix uses ``coreai.reshape(inp, new_shape)`` with
a Python list to promote a dynamic non-concat axis to its known static
size before the concat. The list form materializes the shape as an
``int32`` constant tensor, so every entry must be a real int — there is
no slot for the dynamic-size sentinel.
When a cat input has both a promotable axis (sibling has a known static
size) and an axis that is dynamic on every input (no static sibling),
post-promotion ``new_shape`` is a mix of concrete ints and the dynamic
sentinel; passing it to the list-form reshape raises
``OverflowError: Python integer -9223372036854775808 out of bounds for
int32``.
Split ``replace_cat`` into two reshape paths:
- All axes static post-promotion: keep the list-form reshape.
- Some axes still dynamic post-promotion: build the shape vector at
runtime — ``coreai.get_shape(inp)`` for the still-dynamic axes,
``coreai.constant`` slices for the promoted axes, concat along axis 0
to get a rank-1 ``int32`` Value, and pass that to Value-form
``coreai.ReshapeOp`` with a partially-static result type.
Adds a numerical regression that exercises the mixed path: a 4-D cat
where one input has a sibling-promotable axis and another axis that
stays dynamic on every input. Verified to fail with the list-form-only
fix and pass with this delta.1 parent 1c26f1f commit 0cd3c80
2 files changed
Lines changed: 46 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
977 | | - | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
978 | 997 | | |
979 | 998 | | |
980 | 999 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1024 | 1024 | | |
1025 | 1025 | | |
1026 | 1026 | | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
1027 | 1053 | | |
1028 | 1054 | | |
1029 | 1055 | | |
| |||
0 commit comments