forked from llvm/torch-mlir
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OnnxToTorch lowering resize op (cherry-picks from upstream) (CR-1196776) #168
Merged
Conversation
This file contains 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
nod-ai/SHARK-ModelDev#358 adds a lowering from onnx to linalg for bilinear and nearest resize with support for using scales or sizes to get resize shape. uses coordinate transform half pixel for bilinear mode and asymmetrical for nearest mode. See https://github.com/onnx/onnx/blob/main/docs/Operators.md#Resize. Added two passes -- one for bilinear and the other for nearest.
…ering (llvm#3351) Addresses [Shark-Turbine Related tracker [Shark-Turbine Related onnx.Resize issues [Shark-Turbine
The old lowering only had logic for 2d (i.e. images). this patch allows interpolation for n spatial dims, which is required for some 3d vision models such as - onnx/models/pytorch-3dunet_vaiq_int8 which successfully compiles and runs with this patch.
Updates: - some unsupported modes are now going to report a match failure for unsupported coordinate transformation modes. - fixes a bug that was introduced in the last patch for resize (my bad...) - uses actual x and y coordinates for computing weights in bilinear interpolation (rather than eps modified values) - slightly simplifies the bilinear interpolation payload for readability and performance - passes coordinate transformation mode information from an onnx.Resize op to the mode string for the aten._interpolate op. This allows us to perform custom logic in the torch->linalg lowering to support onnx.Resize options without losing the default behaviors of the interpolate op.
mgehre-amd
changed the title
OnnxToTorch lowering resize op cherry-picks from upstream
OnnxToTorch lowering resize op (cherry-picks from upstream) (CR-1196776)
Jun 6, 2024
franciscofd
approved these changes
Jun 6, 2024
mgehre-amd
force-pushed
the
matthias.onnx_resize
branch
from
June 6, 2024 19:15
f08a4a1
to
070e9cd
Compare
mgehre-amd
force-pushed
the
matthias.onnx_resize
branch
from
June 7, 2024 06:46
3e48fef
to
96addd1
Compare
flemairen6
approved these changes
Jun 7, 2024
Merged
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.
This are the commits from upstream required to lower onnx.Resize to linalg.
In addition, I fixed the default nearest_mode to be round_prefer_floor as specified by ONNX, and implemented coordTfMode half_pixel.