Skip to content

Conversation

@PatrikPerssonInceptron
Copy link
Contributor

Expand

Updated Expand converter in onnx frontend to to handle dynamic shape expressions by matching data and target_shape
dimension lengths and converting any target shape elements assigned to -1 to the data shape dimension.

Added regression test to onnx frontend testing Expand with a dynamic shape

Additional small fixes

I replaced int(k.data.numpy()[0]) with int(k.data.numpy().item()) in Trilu since sometimes the data shape is a zero dimensional scalar

I added a function converting from PrimExpr to PrimValue before sending in starts, ends, steps to relax.op.strided_slice since it does not accept PrimeExpr as inputs.

updated slice to convert PrimExpr to PrimValue before sending values to
relax.op.strided_slice
removed unnecessary list comprehension
Copy link
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Hzfengsy Hzfengsy merged commit be3d42b into apache:main Nov 5, 2024
19 checks passed
@PatrikPerssonInceptron PatrikPerssonInceptron deleted the feature/onnx-frontend-slice-expand branch November 5, 2024 10:32
ShiboXing pushed a commit to ShiboXing/tvm that referenced this pull request Aug 10, 2025
…che#17504)

* updated expand to support dynamic relax.ShapeExpr

updated slice to convert PrimExpr to PrimValue before sending values to
relax.op.strided_slice

* added test for dynamic shape expression in test_expand

* updated formatting

removed unnecessary list comprehension
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.

2 participants