Skip to content

[Relax][ONNX] Support Call and Var sequence expressions in sequence operators - #20964

Open
Chaitanya140904 wants to merge 1 commit into
apache:mainfrom
Chaitanya140904:fix-onnx-sequence-ops-ast-input
Open

Chaitanya140904 wants to merge 1 commit into
apache:mainfrom
Chaitanya140904:fix-onnx-sequence-ops-ast-input

Conversation

@Chaitanya140904

Copy link
Copy Markdown

This PR resolves an issue where Relax ONNX sequence operators (SequenceLength, SequenceAt, SequenceErase, SequenceInsert, and ConcatFromSequence) crashed with TypeError when their input sequence was a Relax AST node (such as relax.Call or relax.Var with TupleType) rather than a Python list or static tuple.

Summary of Changes

  • Introduced helper functions _get_sequence_length(seq) and _get_sequence_elements(bb, seq) in python/tvm/relax/frontend/onnx/onnx_frontend.py to safely inspect length and unpack sequence elements across Python sequences (list, tuple), relax.Tuple, and Relax expressions with TupleType (extracting elements via relax.TupleGetItem).
  • Updated SequenceLength, SequenceAt, SequenceErase, SequenceInsert, and ConcatFromSequence to utilize these helpers.
  • Added normalized negative position handling in SequenceAt.
  • Added unit tests in tests/python/relax/test_frontend_onnx.py verifying chaining of SplitToSequence with each sequence operation.

Closes #20949

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] SequenceLength, SequenceErase, and SequenceInsert fail with "TypeError: object of type 'Call' has no len()"

1 participant