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

[primTorch] special: ndtr, ndtri, log_ndtr, erfcx #86077

Closed
wants to merge 10 commits into from

Conversation

khushi-411
Copy link
Contributor

@khushi-411 khushi-411 commented Oct 2, 2022

  • Adds prims and _refs for erfcx and ndtri.
  • Adds _refs for ndtr, and log_ndtr.

cc @kshitij12345 @lezcano @mruberry

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 2, 2022

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/86077

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures, 1 Pending

As of commit 78a25b9:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@khushi-411 khushi-411 marked this pull request as ready for review October 3, 2022 10:24
@anjali411 anjali411 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 3, 2022
@facebook-github-bot
Copy link
Contributor

/easycla

As part of the transition to the PyTorch Foundation, this project now requires contributions be covered under the new CLA. See #85559 for additional details.

This comment will trigger a new check of this PR. If you are already covered, you will simply see a new "EasyCLA" check that passes. If you are not covered, a bot will leave a new comment with a link to sign.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 4, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

type_promotion_kind=utils.ELEMENTWISE_TYPE_PROMOTION_KIND.INT_TO_FLOAT,
)
def ndtr(a: TensorLikeType) -> TensorLikeType:
a_sqrt_2 = a / 1.414213562373095048801688724209698
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look right -- shouldn't this expression be a * M_SQRT1_2 ?

auto x_sqrt_2 = self * M_SQRT1_2;

Copy link
Contributor Author

@khushi-411 khushi-411 Oct 6, 2022

Choose a reason for hiding this comment

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

Hi, @mruberry! Thanks for the question. I believe the formula is right:

Here, it's a * M_SQRT1_2, where M_SQRT1_2 is 1/√2 = 0.70710678118654752440.

And in my impl, I had implemented it as a / √2; √2 = 1.414213562373095048801688724209698.

Anyways, I've updated as per the previous implementation by assigning objects to the constant :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

That makes sense but maybe the multiplication is preferable? Multiplication is typically faster than division

Copy link
Contributor Author

@khushi-411 khushi-411 Oct 6, 2022

Choose a reason for hiding this comment

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

I appreciate your input! I've updated using multiplication :p Thank you :)

@khushi-411
Copy link
Contributor Author

Hi, @mruberry! Gentle ping, please take another look. Thanks

@khushi-411
Copy link
Contributor Author

Hi, Gentle ping, @mruberry!

@mruberry mruberry self-requested a review October 12, 2022 17:46
Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

LGTM!

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 12, 2022
@khushi-411
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions
Copy link

Hey @khushi-411.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

@khushi-411 khushi-411 deleted the prims_refs_ndtr branch October 13, 2022 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request cla signed Merged open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants