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

where() function added as a Tensor method as well #92849

Closed
wants to merge 1 commit into from

Conversation

pierreHaslee
Copy link
Contributor

Fixes #88470

I added the "method" keyword in aten/src/ATen/native/native_functions.yaml for the function where with Scalar Overload.
This way, you can now use Tensor.where() with a scalar parameter the same way torch.where() can.

I added a test in test/test_torch.py as requested.
It uses the where() method on a tensor and then checks it has the same results as the torch.where() function.
The test is roughly the same as the one provided by the author of the issue.

PS: this is the second PR I make to resolve this issue, the first one is #92747. I had troubles with commit signatures and is therefore closed.

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 23, 2023

🔗 Helpful Links

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

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

✅ No Failures

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

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

@H-Huang H-Huang requested a review from albanD January 23, 2023 21:23
@H-Huang H-Huang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jan 23, 2023
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

Perfect! Thanks!

@albanD
Copy link
Collaborator

albanD commented Jan 23, 2023

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 23, 2023
@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

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 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.

Tensor.where inconsistent with torch.where
5 participants