Skip to content

Set exclude_outside=1 on Resize for antialiased upsample#2916

Open
ssam18 wants to merge 1 commit into
microsoft:mainfrom
ssam18:fix/issue-pytorch-183546-aa-exclude-outside
Open

Set exclude_outside=1 on Resize for antialiased upsample#2916
ssam18 wants to merge 1 commit into
microsoft:mainfrom
ssam18:fix/issue-pytorch-183546-aa-exclude-outside

Conversation

@ssam18
Copy link
Copy Markdown

@ssam18 ssam18 commented May 13, 2026

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.

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.
@ssam18
Copy link
Copy Markdown
Author

ssam18 commented May 13, 2026

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

ONNX export of F.interpolate(..., antialias=True) does not preserve PyTorch eager semantics

1 participant