The GitHub Actions job "CI" on tvm.git/fix/relax-torch-split-int-split-size has 
succeeded.
Run started by GitHub user siyiweigeHEW (triggered by siyiweigeHEW).

Head commit for run:
e907c6439c8a702ac291830682ae6b951d108806 / HuEnwei <[email protected]>
[Relax][Frontend][PyTorch] Fix x.split(int) with a non-divisible split_size

torch.split(x, s, dim) splits dim into chunks of size s, with the last
chunk smaller when D % s != 0. The frontend `_split` converter
(base_fx_graph_translator.py) converted the per-chunk size into a
section count n_section = ceil(D / s) and passed it to relax.op.split's
integer argument, whose semantics are "split into n_section equal
sections" (each of size ceil(D / n_section)). Whenever
ceil(D / ceil(D / s)) != s -- e.g. split_size > D/2 with a non-divisible
D -- valid PyTorch models silently produced differently-shaped chunks
(e.g. x.split(6) on a (10,) tensor yielded (5,), (5,) instead of
(6,), (4,)).

Convert the int per-chunk size to the cumulative cut positions
[s, 2s, ..., (ceil(D/s) - 1)*s] instead, the same list form the
list/tuple branch already passes to relax.op.split.

Differential testing vs native PyTorch (fixed `_split` injected
verbatim): the 10 previously-diverging cases (non-divisible
split_size > D/2 across dim=0, dim=1 and negative dims) all now match
torch shapes and values; the divisible-size baseline and the list/tuple
(split_with_sizes) control group remain unchanged. Added regression
test test_split_int_split_size covering the structural IR
(R.split(input, indices_or_sections=[6], axis=0) for x.split(6) on a
(10,) input) and numerical equivalence for non-divisible sizes/dims.
The pre-existing test_split expected IR in
tests/python/relax/test_frontend_from_fx.py asserted the old int-section
form (indices_or_sections=3 for x.split(1, dim=1)); it is updated to the
correct list form ([1, 2]).

Co-Authored-By: Claude <[email protected]>

Report URL: https://github.com/apache/tvm/actions/runs/33331841488

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to