Set exclude_outside=1 on Resize for antialiased upsample#2916
Open
ssam18 wants to merge 2 commits into
Open
Conversation
ONNX Resize defaults exclude_outside=0 while PyTorch's antialiased upsample kernels drop out of bounds samples from the filter window and renormalize the remaining weights so they sum to one. Without exclude_outside=1 the exported model produces values that differ from eager near the boundary. This also drops the shape only test guard for the AA upsample ops so the existing numerical comparison runs again. Fixes pytorch/pytorch#183546.
Author
|
@microsoft-github-policy-service agree |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2916 +/- ##
=======================================
Coverage 72.61% 72.61%
=======================================
Files 259 259
Lines 31597 31597
Branches 2973 2973
=======================================
Hits 22945 22945
Misses 7643 7643
Partials 1009 1009 ☔ View full report in Codecov by Sentry. |
The exclude_outside=1 change fixes the align_corners=False / no-scales path. Two cases still diverge: align_corners=True (the AA scale formula differs between PyTorch and ONNX Resize) and align_corners=False with explicit scales_h/scales_w (PyTorch ignores the scales, ONNX honors them same pre-existing mismatch already xfailed on the non-AA variants). Add matching .xfail matchers on both _upsample_bilinear2d_aa and _upsample_bicubic2d_aa so CI is green while the remaining gaps stay tracked.
auto-merge was automatically disabled
May 18, 2026 18:30
Head branch was pushed to by a user without write access
justinchuby
reviewed
May 18, 2026
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
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.
F.interpolate with antialias=True did not match PyTorch eager after ONNX export. The cause is that ONNX Resize defaults exclude_outside=0 while PyTorch's eager kernels drop out of bounds samples and renormalize the filter weights to sum to one. This change threads exclude_outside=1 through _aten_upsample_output_size and _aten_upsample_scales and sets it for the bilinear and bicubic AA paths. The shape only test guard for the two AA upsample ops is removed so the existing numerical comparison runs again.
Fixes pytorch/pytorch#183546.