-
Notifications
You must be signed in to change notification settings - Fork 83
[torchlib] Improve pixel_shuffle #2537
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
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
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.
Pull Request Overview
This PR optimizes the pixel_shuffle and pixel_unshuffle operations in the torch library by adding fast paths for 4D inputs and improving shape handling for higher-dimensional tensors.
- Adds early return optimization for 4D tensors that can directly use ONNX DepthToSpace/SpaceToDepth operations
- Replaces tensor slicing with explicit op.Slice calls for better shape manipulation
- Adds trace_only=True parameter to both function decorators
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2537 +/- ##
==========================================
- Coverage 69.93% 69.93% -0.01%
==========================================
Files 216 216
Lines 26048 26052 +4
Branches 2614 2616 +2
==========================================
+ Hits 18217 18219 +2
Misses 6931 6931
- Partials 900 902 +2 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Simplify the graph when input rank is 4, in which case we don't need to do any shape manipulation.
Fix pytorch/pytorch#162061