Repository navigation
Conversation
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 #20877.
Problem
In TOPI
get_inx,tf_crop_and_resizealready selects the ROI midpoint when the output extent is one. However, both arguments tote.if_then_elseare constructed eagerly. Building the unselected branch divides bytarget_width - 1, which is zero for a static unit extent, and raisesDivide by zerobefore the conditional can discard it.Change
Use
max(target_width - 1, 1)as the denominator of that branch. For output extents greater than one this is the original denominator; for a unit extent the existing conditional still selects the unchanged ROI-center expression. The denominator is also safe with symbolic extents.This change is confined to
tf_crop_and_resize; it does not changealign_cornersor address empty-output handling.Regression coverage
Validation
git diff --checkpassed.The main TOPI resize Python module was loaded verbatim into an existing local TVM 0.26.dev0 LLVM runtime. The pre-/post-TIRx-extraction compatibility aliases are kept outside this PR. This is not a full build or full-suite result for current main; upstream CI is required.
For a current-main build: