KEMBAR78
Documentation Fix: Torch gather broadcasting by morrison-turnansky · Pull Request #157920 · pytorch/pytorch · GitHub
Skip to content

Conversation

@morrison-turnansky
Copy link
Contributor

updated torch gather docs to reflect proper broadcasting behavior for specific backends

Fixes #157425

@pytorch-bot
Copy link

pytorch-bot bot commented Jul 9, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit c4207fb with merge base e3f2597 (image):
💚 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 the release notes: python_frontend python frontend release notes category label Jul 9, 2025
@morrison-turnansky
Copy link
Contributor Author

@albanD Please let me know if these changes are sufficient. Thank you

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.

From checking locally, this is not actually true.
It indeed doesn't broadcast and only the error checking is disabled for empty Tensor (nelement() == 0).
You should update the doc with that instead: keep what is there but add a line saying that for empty indices, we always return an empty output with the same shape without further error checking

@morrison-turnansky morrison-turnansky force-pushed the issue-157425-gather-broadcast branch from 0edd630 to c4207fb Compare July 9, 2025 18:48
@morrison-turnansky
Copy link
Contributor Author

@albanD I have updated the PR according to your comments.

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.

Thx

@albanD
Copy link
Collaborator

albanD commented Jul 10, 2025

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 10, 2025
@pytorchmergebot
Copy link
Collaborator

PR targets viable/strict rather than main, refusing merge request

@morrison-turnansky morrison-turnansky changed the base branch from viable/strict to main July 10, 2025 17:40
@morrison-turnansky
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

@morrison-turnansky morrison-turnansky deleted the issue-157425-gather-broadcast branch October 3, 2025 17:42
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 release notes: python_frontend python frontend release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The torch.gather documentation states that input and index must have the same number of dimensions. However, no corresponding validation is added.

4 participants