Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add TORCH_CHECK for group < channels for native_channel_shuffle #153781

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

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

Conversation

aishwaryar12309
Copy link
Contributor

@aishwaryar12309 aishwaryar12309 commented May 17, 2025

Fixes #153231

Changes

  • Added TORCH_CHECK(groups <= channels) to prevent silent misbehavior in native_channel_shuffle when the number of groups is larger than the input's channel dimension. Files changed: aten/src/ATen/native/ChannelShuffle.cpp

Motivation

  • Previously, the function allowed groups > channels, which silently produced incorrect behavior or segmentation faults downstream. This check ensures correctness and surfaces misuse early.

Labels: module: nn, module: crash, module: edge cases
cc @albanD

Copy link

pytorch-bot bot commented May 17, 2025

🔗 Helpful Links

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

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

❌ 2 New Failures

As of commit 4d1aa81 with merge base 8568dbc (image):

NEW FAILURES - The following jobs have failed:

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

Copy link
Contributor

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@HDCharles HDCharles requested a review from albanD May 20, 2025 17:47
@HDCharles HDCharles added topic: bug fixes topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels May 20, 2025
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.

Thanks!
Would you be able to add a small test in test_torch.py to make sure it raises as expected now?

@aishwaryar12309
Copy link
Contributor Author

I can add a test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open source topic: bug fixes topic 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.

torch.native_channel_shuffle crashes with Floating Point Exception when given large integer parameter
4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.