Skip to content
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

Atan2 converter #1381

Merged
merged 12 commits into from
Oct 5, 2022
Merged

Atan2 converter #1381

merged 12 commits into from
Oct 5, 2022

Conversation

gs-olive
Copy link
Collaborator

Description

This feature adds the atan2 converter, as mentioned in Issue #938.

Fixes #938

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [ x ] My code follows the style guidelines of this project (You can use the linters)
  • [ x ] I have performed a self-review of my own code
  • [ x ] I have commented my code, particularly in hard-to-understand areas and hacks
  • [ x ] I have made corresponding changes to the documentation
  • [ x ] I have added tests to verify my fix or my feature
  • [ x ] New and existing unit tests pass locally with my changes
  • [ x ] I have added the relevant labels to my PR in so that relevant reviewers are notified

- Add atan2 converter
- Update test cases to reflect edge cases with quadrants of atan2
- Ensure quadrants are respected based on signs of input Tensors
- Fix bug in implementation relating to quadrant correction
@facebook-github-bot
Copy link
Contributor

Hi @gs-olive!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@github-actions github-actions bot added component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: tests Issues re: Tests labels Sep 26, 2022
auto ZERO = tensor_to_const(ctx, torch::tensor({0.}));
auto ONE = tensor_to_const(ctx, torch::tensor({1.}));
auto TWO = tensor_to_const(ctx, torch::tensor({2.}));
auto PI = tensor_to_const(ctx, torch::tensor({M_PI}));
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://github.com/pytorch/pytorch/blob/087049000b6f884221640f5748346b81e9be9572/c10/util/MathConstants.h

Here is PyTorch's PI definition. I think c10::pi<float>() should be right. Please make a note that we'd prefer double from a pytorch perspective.

@@ -1,3 +1,4 @@
#include <c10/util/MathConstants.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

small style thing, I know other files might use <> to include torch, libraries but use "" for anything other than stdlib

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the <> notation to "" on both this new import, as well as the existing torch/torch.h import in this file

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@narendasan narendasan marked this pull request as ready for review October 5, 2022 00:18
@narendasan narendasan merged commit dfd8c36 into pytorch:master Oct 5, 2022
@gs-olive gs-olive deleted the atan2_converter branch October 5, 2022 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

↔ [Converter] Add support for aten::atan2 in Torch-TensorRT
3 participants