-
Notifications
You must be signed in to change notification settings - Fork 64
[torchlib] Fix calls to Unsqueeze to provide correct 1d axes #2186
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
onnxscript/function_libs/torch_lib/ops/special.py:222
- [nitpick] Consider using the 'axes' keyword for clarity (e.g., op.Unsqueeze(self, axes=[0])) to align with other parts of the codebase.
self = op.Unsqueeze(self, [0])
onnxscript/function_libs/torch_lib/ops/nn.py:1005
- [nitpick] For consistency, consider adopting the use of the 'axes' keyword in both Unsqueeze and Squeeze calls throughout the file.
self = op.Unsqueeze(self, [0])
onnxscript/function_libs/torch_lib/ops/core.py:7882
- [nitpick] To maintain a consistent API usage across the codebase, consider using the 'axes' keyword (e.g., op.Unsqueeze(index_base, axes=[-1])).
index_base = op.Unsqueeze(index_base, [-1])
❌ 4 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember noticing something like this while writing some fusion patterns. May need to double-check fusion patterns in case they are impacted by this. (Just noting it down here before I forget!)
Discovered in onnx/onnx#6886 (comment), the
axes
input in calls to unsqueeze are sometimes 0d. This is incorrect according to the ONNX spec. The PR fixes the instances I could find.