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

[MPS] Support for median with dim #88807

Closed
wants to merge 3 commits into from

Conversation

Raman-Kumar
Copy link
Contributor

@Raman-Kumar Raman-Kumar commented Nov 10, 2022

Summary ⚡

Aim: Add support for aten::median for MPS backend (Fixes #87220)

This is fresh clean PR from the previous PR

  • Implementing the new median function in aten/src/ATen/native/mps/operations/ReduceOps.mm
  • Adding it to aten/src/ATen/native/native_functions.yaml
  • Adding it to existing test_median

this will works like this 🪶

median of entire input tensor on MPS
torch.median(mps_inputTensor)
median of along a dim
torch.median(mps_inputTensor, dim=[int], keepdim=[Bool])

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 10, 2022

🔗 Helpful Links

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

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

✅ No Failures

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

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

@pytorch-bot pytorch-bot bot added ciflow/mps Run MPS tests (subset of trunk) release notes: mps Release notes category labels Nov 10, 2022
@Raman-Kumar Raman-Kumar marked this pull request as ready for review November 10, 2022 14:37
@albanD albanD added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Nov 10, 2022
@Raman-Kumar
Copy link
Contributor Author

Hi, @kulinseth
rebased this branch with master
some workflow waiting for approval

As suggested in previous PR review

now using is_macos_13_or_newer() for query to check macOS 13+
also moved interface to MPSGraphVenturaOps.h

🧪Added test case for if median at odd place and if at even place in test_median

Copy link
Collaborator

@kulinseth kulinseth left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks

@kulinseth
Copy link
Collaborator

@pytorchbot merge

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

kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
## Summary ⚡

**Aim**: Add support for aten::median for MPS backend (Fixes pytorch#87220)

This is fresh clean PR from the previous [PR](pytorch#88554)

- Implementing the new median function in aten/src/ATen/native/mps/operations/ReduceOps.mm
- Adding it to aten/src/ATen/native/native_functions.yaml
- Adding it to existing test_median

### **this will works like this** 🪶
median of entire input tensor on MPS
`torch.median(mps_inputTensor)`
median of along a dim
`torch.median(mps_inputTensor, dim=[int], keepdim=[Bool])`
Pull Request resolved: pytorch#88807
Approved by: https://github.com/kulinseth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/mps Run MPS tests (subset of trunk) ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: mps Release notes category 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.

[MPS] Add support for aten::median for MPS backend
5 participants