Mr-Neutr0n opened a new pull request, #18774:
URL: https://github.com/apache/tvm/pull/18774

   ## Summary
   
   Fixes #18751
   
   The ONNX frontend's Split converter crashes when the tensor dimension isn't 
evenly divisible by `num_outputs`. For example, splitting a length-10 tensor 
into 3 parts should produce `[4, 4, 2]` per the ONNX Opset 18 spec, but the 
converter only handled perfectly divisible cases.
   
   **Root cause:** When no explicit `split` sizes are provided, both `_impl_v1` 
and `_impl_v13` pass the raw `num_outputs` integer to `relax.op.split`. While 
the underlying op supports uneven splits in theory, the conversion fails during 
model normalization for non-divisible dimensions.
   
   **Fix:** Added a `_compute_split_indices` helper that computes explicit 
cumulative split indices using ceil-based block sizes when the input shape is 
statically known:
   
   ```
   block_size = ceil(dim / num_outputs)
   indices = [block_size, 2*block_size, ..., (N-1)*block_size]
   ```
   
   For a length-10 tensor with `num_outputs=3`: `block_size = ceil(10/3) = 4`, 
indices = `[4, 8]`, producing splits of `[4, 4, 2]`. Falls back to passing the 
integer for dynamic shapes.
   
   ## Test plan
   
   - Added test cases for 1D uneven split (10 / 3 -> [4, 4, 2])
   - Added test cases for 2D uneven split along axis 1 (7 / 3 -> [3, 3, 1])
   - Existing even-split tests remain unchanged and should continue to pass


-- 
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]

Reply via email to