Set exclude_outside=1 on Resize for antialiased upsample#2916
Open
ssam18 wants to merge 1 commit 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 |
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.