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

Add torch.put_along_dim and torch.put_along_dim_ like np.put_along_axis #125601

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

arunppsg
Copy link
Contributor

@arunppsg arunppsg commented May 6, 2024

Fixes #120209

cc @albanD

Copy link

pytorch-bot bot commented May 6, 2024

🔗 Helpful Links

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

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

❌ 51 New Failures

As of commit bbcf254 with merge base 60bbdc0 (image):

NEW FAILURES - The following jobs have failed:

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

@arunppsg arunppsg marked this pull request as ready for review June 15, 2024 16:57
@mikaylagawarecki mikaylagawarecki added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jun 17, 2024
@lezcano lezcano added the module: python frontend For issues relating to PyTorch's Python frontend label Jun 17, 2024
Copy link
Collaborator

@lezcano lezcano left a comment

Choose a reason for hiding this comment

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

This looks quite good!

Now, rather than adding a one-off test, could you add an OpInfo within common_methods_invocations.py. You can even specify a NumPy reference there and a test will test your implementation against it.

Make sure all the relevant tests in test_ops*.py pass locally before submitting :)

aten/src/ATen/native/TensorAdvancedIndexing.cpp Outdated Show resolved Hide resolved
aten/src/ATen/native/TensorAdvancedIndexing.cpp Outdated Show resolved Hide resolved
np.put_along_axis(t_np, indices_np, values_np, dim)
self.assertEqual(actual, t_np, atol=0, rtol=0)

t = torch.tensor([[10, 30, 20], [60, 40, 50]], dtype=dtype)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you test the broadcasting behaviour between the different tensors, for both dim specified and =None?

aten/src/ATen/native/TensorAdvancedIndexing.cpp Outdated Show resolved Hide resolved
@arunppsg
Copy link
Contributor Author

Made some of the change and work in progress for OpInfo tests.

@lezcano
Copy link
Collaborator

lezcano commented Jun 20, 2024

changes so far look good. Thank you!

@arunppsg arunppsg requested a review from mruberry as a code owner July 4, 2024 16:59
@arunppsg
Copy link
Contributor Author

arunppsg commented Jul 4, 2024

Added simple OpInfo test, though one test is failing: test_non_standard_bool_values_put_along_dim_cpu_bool - working on debugging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: python frontend For issues relating to PyTorch's Python frontend 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.

torch.put_along_dim and torch.put_along_dim_ like np.put_along_axis
4 participants