-
Notifications
You must be signed in to change notification settings - Fork 66
[torchlib] Implement aten__upsample_bicubic2d_aa and aten__upsample_bilinear2d_aa functions #2383
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
Merged
Conversation
This file contains hidden or 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
…a functions Co-authored-by: justinchuby <[email protected]>
Copilot finished work on behalf of
justinchuby
June 14, 2025 03:59
❌ 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 |
justinchuby
approved these changes
Jun 14, 2025
titaiwangms
reviewed
Jun 16, 2025
…rectness concerns Co-authored-by: titaiwangms <[email protected]>
Copilot finished work on behalf of
titaiwangms
June 16, 2025 20:06
titaiwangms
approved these changes
Jun 17, 2025
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.
Tested with pytorch/pytorch#128818, and it works!
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.
This PR implements the missing anti-aliasing (AA) variants of upsample functions that were requested in issue #1159:
aten__upsample_bicubic2d_aa
- bicubic 2D upsampling with anti-aliasingaten__upsample_bilinear2d_aa
- bilinear 2D upsampling with anti-aliasingChanges Made
Core Implementation
Modified helper functions to support anti-aliasing:
antialias
parameter (default=0) to_aten_upsample_output_size()
antialias
parameter (default=0) to_aten_upsample_scales()
Implemented AA functions with same signatures as regular variants:
Both functions pass
antialias=1
to enable ONNX Resize anti-aliasing.Test Configuration
extra_opinfo.py
for both AA functionsops_test_data.py
withcompare_shape_only_for_output=(0,)
since ONNX and PyTorch use different anti-aliasing algorithmsTechnical Details
The AA variants use the same underlying logic as regular upsample functions but enable anti-aliasing in the ONNX Resize operation. As noted in the original issue discussion, ONNX and PyTorch implement different anti-aliasing methods, so tests compare shapes rather than exact values.
Example usage:
Testing Results
antialias=0
andantialias=1
This implementation matches the approach from the previous PR #1259 and completes the upsample function suite requested in the issue.
Fixes #1159. Fixes pytorch/pytorch#128818
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.