Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RELAX][ONNX] Add support for dynamic shape expression in Expand #17504

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
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