You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "rknastenka (via GitHub)" <gi...@apache.org> on 2026/04/06 05:34:40 UTC
[PR] [Relax][ONNX] Support ConcatFromSequenc/SequenceInsert with new_axis=1 [tvm]
rknastenka opened a new pull request, #19361:
URL: https://github.com/apache/tvm/pull/19361
## Description
This PR adds support for `new_axis=1` in the ONNX `ConcatFromSequence` operator, which was previously raising a `NotImplementedError`.
*Note regarding the tracking issue:* The tracking issue listed this task as "SequenceInsert — Does not support inserting with new axis.", but i think it meant `ConcatFromSequence`. ONNX's `SequenceInsert` does not have a `new_axis` attribute, whereas `ConcatFromSequence` does and was throwing the "Insert new axis is not supported yet" error. This PR implements the missing feature.
## Changes:
- Replaced the `NotImplementedError` in `ConcatFromSequence` with `relax.op.stack(inputs[0], axis=axis)`
- Removed the `pytest.skip` from `test_concat_from_sequence`.
- Parameterized the test to explicitly check both standard concatenation (`new_axis=0, axis=0` yielding `[64, 32]`) and stacking operations (`new_axis=1, axis=1` yielding `[32, 2, 32]`).
## Testing
I tested the implementation via running:
```
pytest tests/python/relax/test_frontend_onnx.py::test_concat_from_sequence
```
and all tests passed:
<img width="1044" height="89" alt="image" src="https://github.com/user-attachments/assets/25d6ad26-ad4b-4437-9fa5-e29efc9e0c9f" />
## Reference
https://onnx.ai/onnx/operators/onnx__ConcatFromSequence.html
https://onnx.ai/onnx/operators/onnx__SequenceInsert.html
Fixes part of #18945
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [Relax][ONNX] Support ConcatFromSequenc/SequenceInsert with new_axis=1 [tvm]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #19361:
URL: https://github.com/apache/tvm/pull/19361#discussion_r3038063133
##########
tests/python/relax/test_frontend_onnx.py:
##########
@@ -3762,19 +3762,23 @@ def test_sequence_insert(explicit_position: bool):
check_correctness(model)
-@pytest.mark.parametrize("new_axis", [0, 1])
-def test_concat_from_sequence(new_axis: Literal[0, 1]):
- if new_axis == 1:
- pytest.skip("ConcatFromSequence with new_axis=1 is not supported yet")
+@pytest.mark.parametrize(
+ "new_axis,axis,expected_shape",
+ [
+ (0, 0, [64, 32]),
+ (1, 1, [32, 2, 32]),
+ ],
Review Comment:

To improve test coverage, could you please also add a test case for concatenation along `axis=1`? The previous version of this test hardcoded `axis=1`, so it would be good to retain a test for that case.
```python
[
(0, 0, [64, 32]),
(0, 1, [32, 64]),
(1, 1, [32, 2, 32]),
],
```
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [Relax][ONNX] Support ConcatFromSequenc/SequenceInsert with new_axis=1 [tvm]
Posted by "rknastenka (via GitHub)" <gi...@apache.org>.
rknastenka closed pull request #19361: [Relax][ONNX] Support ConcatFromSequenc/SequenceInsert with new_axis=1
URL: https://github.com/apache/tvm/pull/19361
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [Relax][ONNX] Support ConcatFromSequenc/SequenceInsert with new_axis=1 [tvm]
Posted by "tlopex (via GitHub)" <gi...@apache.org>.
tlopex merged PR #19361:
URL: https://github.com/apache/tvm/pull/19361
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [Relax][ONNX] Support ConcatFromSequenc/SequenceInsert with new_axis=1 [tvm]
Posted by "rknastenka (via GitHub)" <gi...@apache.org>.
rknastenka commented on PR #19361:
URL: https://github.com/apache/tvm/pull/19361#issuecomment-4193010219
**Last Commits summary:**
- support more test cases (1,0) & (1, -1)
- validation check for new_axis not in (0, 1)
- Refactor `SequenceInsert` with proper out-of-bounds boundary checks
- Refactor `SequenceErase` and `SequenceInsert` to use pythonic list unpacking.
- Add 2 more tests including (multiple tensors, edge dimensions, and exception handling)
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [Relax][ONNX] Support ConcatFromSequenc/SequenceInsert with new_axis=1 [tvm]
Posted by "rknastenka (via GitHub)" <gi...@apache.org>.
rknastenka commented on code in PR #19361:
URL: https://github.com/apache/tvm/pull/19361#discussion_r3038079314
##########
tests/python/relax/test_frontend_onnx.py:
##########
@@ -3762,19 +3762,23 @@ def test_sequence_insert(explicit_position: bool):
check_correctness(model)
-@pytest.mark.parametrize("new_axis", [0, 1])
-def test_concat_from_sequence(new_axis: Literal[0, 1]):
- if new_axis == 1:
- pytest.skip("ConcatFromSequence with new_axis=1 is not supported yet")
+@pytest.mark.parametrize(
+ "new_axis,axis,expected_shape",
+ [
+ (0, 0, [64, 32]),
+ (1, 1, [32, 2, 32]),
+ ],
Review Comment:
Done, tested again after this modification and all tests passed
<img width="1029" height="107" alt="image" src="https://github.com/user-attachments/assets/543c31a7-a989-44ee-8725-16cbfbdea0f0" />
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org