-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[FIX][ONNX][RELAX] Add support for dynamic ShapeExpr in Slice, Squeeze and Flatten #17490
Merged
Hzfengsy
merged 9 commits into
apache:main
from
PatrikPerssonInceptron:fix-onnx-frontend
Oct 31, 2024
Merged
[FIX][ONNX][RELAX] Add support for dynamic ShapeExpr in Slice, Squeeze and Flatten #17490
Hzfengsy
merged 9 commits into
apache:main
from
PatrikPerssonInceptron:fix-onnx-frontend
Oct 31, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updated formatting
cc @Hzfengsy can you help to take a look |
Thanks for the contribution, please add a regression test :) |
My pleasure, where exactly in the code should I add the regression tests? :) |
|
check for tuple or None type axis where relevant
added isinstance(tvm_out, (int, float, bool)) in check_correctness since the VM can return primitive types added test case for squeeze with constant input added test case for squeeze with dynamic input shape added test case for squeeze with dynamic shape expression added test case for slice with dynamic shape expression fixed bug in test_split which cased the constant split case never to occur
Hzfengsy
approved these changes
Oct 30, 2024
LGTM. Thanks for the contribution!!! |
Happy to help! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Squeeze
I added a tuple wrapping around axis when sending it to _np.squeeze since it does not support list objects. I added an additional check to see if the data is a ShapeExpr. If this is the case I perform the inverse of the operations done in the Unsqueeze operation.
Slice
I fixed a bug where the dimensions were assumed to be of IntImm data type by adding an additional check to handle the constant and dynamic case separately.
Flatten
I fixed a bug where the dimensions were assumed to be of IntImm data type by adding an additional check to handle the constant and dynamic case separately.
Split
I replaced asnumpy with numpy since asnumpy is deprecated. I added a call to .item() to convert from numpy data types to python primitives.
Regression Tests
I extracted generate_random_value function from generate_random_inputs.
I added isinstance(tvm_out, (int, float, bool)) in check_correctness since the VM can return python primitive types
Squeeze
I added a test case for squeeze with constant input since it was missing
I added a test case for squeeze with dynamic input shape
I added a test case for squeeze with dynamic shape expression
Slice
I added a test case for slice with dynamic shape expression
Split
I fixed a bug in test_split which caused the constant split case never to occur