Skip to content

[Relax][PyTorch] Add atan2 converter#19850

Open
javierdejesusda wants to merge 1 commit into
apache:mainfrom
javierdejesusda:relax-torch-atan2
Open

[Relax][PyTorch] Add atan2 converter#19850
javierdejesusda wants to merge 1 commit into
apache:mainfrom
javierdejesusda:relax-torch-atan2

Conversation

@javierdejesusda

Copy link
Copy Markdown
Contributor

Motivation

torch.atan2 was not registered in either the ExportedProgram or FX frontend,
so importing a model that uses it failed with an "Unsupported function types"
error. The relax.op.atan2 operator already exists and legalizes to
topi.atan2, so the frontends only needed to route the op to it.

Changes

  • Register atan2 in the FX frontend and atan2.default in the ExportedProgram
    frontend, reusing the shared _binary_op helper (the same pattern as the
    existing maximum/minimum/logaddexp converters).
  • Add a structural test in test_frontend_from_fx.py and
    test_frontend_from_exported_program.py.

torch.atan2 was not registered in either the ExportedProgram or FX frontend,
so importing a model that uses it failed with an "Unsupported function types"
error. The relax.op.atan2 operator already exists and legalizes to topi.atan2,
so the frontends only needed to route the op to it.

Register atan2 in the FX frontend and atan2.default in the ExportedProgram
frontend, reusing the shared _binary_op helper (the same pattern as the
existing maximum/minimum/logaddexp converters), and add a structural test in
both test_frontend_from_fx.py and test_frontend_from_exported_program.py.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the atan2 operator in both the FX translator and the exported program translator within the TVM Relax PyTorch frontend. It also includes corresponding unit tests to verify the translation. No review comments were provided, and I have no additional feedback to offer as the changes are clean and well-tested.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant