Skip to content

[FIX][ONNX] Preserve scalar SplitToSequence chunk boundaries - #21134

Open
shpetimhaxhiu wants to merge 1 commit into
apache:mainfrom
shpetimhaxhiu:fix/onnx-scalar-split-to-sequence
Open

shpetimhaxhiu wants to merge 1 commit into
apache:mainfrom
shpetimhaxhiu:fix/onnx-scalar-split-to-sequence

Conversation

@shpetimhaxhiu

@shpetimhaxhiu shpetimhaxhiu commented Dec 4, 2026 •

Copy link
Copy Markdown

Fixes #21132. Thanks to @tangyixuan01 for isolating the scalar and vector forms and identifying the incorrect lowering.

ONNX uses a scalar split input as the chunk size. Relax interprets an integer split argument as the number of equal sections. For a six-element input and scalar split of four, the old lowering emitted two sections of length three and put element 3 in the second chunk.

This change emits cut positions at multiples of the chunk size for an uneven split and keeps equal sections for divisible sizes. The regression test checks the expected Relax IR for a 4 + 2 split and a separate split with two cut positions. A Windows x64 LLVM comparison using the published 0.27.0.post1 wheel with this converter change checks shapes and values against ONNX Runtime for nine synthetic cases, including negative axes, an explicit vector, and default and even splits.

The current checkout also built successfully with MSVC and the Apache TIRx LLVM target on Windows x64. The unmodified frontend failed the three uneven cases. The patched checkout passed the nine value comparisons, two invalid-input checks, and all four repository SplitToSequence tests.

OpenAI Codex assisted with the implementation and validation.

Use explicit split indices when a scalar chunk size leaves a remainder. Keep equal sections for divisible sizes.

Reported-by: tangyixuan01 (apache#21132)

Generated-by: OpenAI Codex (GPT-6)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Relax][ONNX] SplitToSequence returns chunks of sizes 3 and 3 for scalar split=4 on a length-6 input

1 participant