Support PyTorch angle and trig ops (deg2rad, rad2deg, hypot) - #2817
Open
jaseem-kurikkal wants to merge 1 commit into
Open
Support PyTorch angle and trig ops (deg2rad, rad2deg, hypot)#2817jaseem-kurikkal wants to merge 1 commit into
jaseem-kurikkal wants to merge 1 commit into
Conversation
Collaborator
|
This change looks good. CI: https://gitlab.com/coremltools1/coremltools/-/pipelines/2767302112 |
Collaborator
|
There are some unit test failures. Looks like some of these operations are not supported by executorch. Please skip the failed tests for that frontend. |
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.
Summary
Adds support for PyTorch angle and trigonometric operators (
deg2rad,rad2deg, andhypot) in the PyTorch converter frontend.Context / Motivation
torch.deg2rad,torch.rad2deg, andtorch.hypotare standard PyTorch operators commonly used in 3D computer vision, robotics, coordinate transformations, and audio processing. Previously, converting models utilizing these operators raisedNotImplementedError.Changes
deg2radconverter viamb.mul(x, pi / 180.0).rad2degconverter viamb.mul(x, 180.0 / pi).hypotconverter viamb.sqrt(x^2 + y^2)with input dtype promotion.TestDeg2Rad,TestRad2Deg, andTestHypotintest_torch_ops.pycovering TorchScript and TorchExport across all backend and compute unit permutations.Testing
Ran:
pytest coremltools/converters/mil/frontend/torch/test/test_torch_ops.py -k "TestDeg2Rad or TestRad2Deg or TestHypot"