Repository navigation
[Fix][TOPI] Handle singleton align-corners resize axes - #20992
Open
DiadkoShmek wants to merge 1 commit into
Open
DiadkoShmek wants to merge 1 commit into
DiadkoShmek wants to merge 1 commit into
Conversation
Clamp the resize coordinate scale denominator to one so a singleton axis maps its only sample to input coordinate zero, for both static and symbolic output extents.
This branch has not been deployed
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.
Fixes #20941.
TOPI's shared
align_cornersmapping divides byoutput_extent - 1. At a singleton extent, constant folding rejects the zero denominator for static shapes, and the symbolic kernel can produce NaN instead of sampling input coordinate zero.Clamp the denominator to one. A singleton axis executes only at output coordinate zero, so the resulting input coordinate is zero. Extents greater than one keep the existing mapping.
On base
23a6dbe710dfcd445a090af1c49c8d7e8a57fb10, four statictorch.exportcases failed with division by zero, while both controls passed. The new symbolic 1D test emitted NaN instead of zero. All seven new regressions and all 31 existing resize/interpolate checks passed on the patch. An additional CPU run compiled one symbolic TOPI kernel per rank and checked nine 1D/3D output shapes against separable NumPy interpolation. Five singleton-containing shapes disagreed on the base. All nine matched exactly with the patch.AI assistance (Codex) was used for the patch, tests, and verification.