[Relax][ONNX] Support ConcatFromSequence new_axis=1 and refactor sequ…#19360
[Relax][ONNX] Support ConcatFromSequence new_axis=1 and refactor sequ…#19360Dayuxiaoshui wants to merge 3 commits into
Conversation
|
cc @tlopex |
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function to standardize ONNX sequence handling and implements support for the new_axis attribute in ConcatFromSequence. It also adds bounds checking for SequenceInsert and expands test coverage. Review feedback suggests using more idiomatic Python for tuple conversion and improving efficiency in SequenceErase by using in-place deletion.
tlopex
left a comment
There was a problem hiding this comment.
Thanks for the PR. A few comments before merge:
-
_onnx_sequence_tuple_as_tensor_listfeels unnecessary since it only doeslist(sequence). I’d just inline it. -
For the insert bounds check, please add a short comment that
position == seq_lenis valid since insert can append to the end. -
In
SequenceErase,del items[position]is okay, but I’d prefer anassert position >= 0for safety, or just keep the original list-comprehension version. -
Maybe also add a basic
axis=0, new_axis=0case.
|
cc @tlopex |
Inline list(sequence) instead of _onnx_sequence_tuple_as_tensor_list. Document that SequenceInsert allows position == seq_len for append. Implement SequenceErase via list comprehension instead of del. Add test_concat_from_sequence_axis0_new_axis0 (explicit axis for ORT) and drop the redundant (0,0) parametrized case.
Summary
ConcatFromSequencewithnew_axis=1:expand_dimsalongaxis, thenconcaton the same axis (matches ONNX Runtime)._onnx_sequence_tuple_as_tensor_listforSequenceErase,SequenceInsert, andConcatFromSequence.SequenceInsert: coercepositiontointand validate insert index.Testing
new_axis/axis(includingaxis=-1); fix expected shape foraxis=1.new_axis=1case; re-runSequenceInsert/SequenceErase.[Tracking Issue][ONNX] Complete missing and limited operators in ONNX frontend #18945