-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
Allow nn.ChannelShuffle to run without erroring on CUDA tensors #105351
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/105351
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5afad35: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D47523764 |
Could you please review this diff? :) |
test/test_nn.py
Outdated
@@ -6490,6 +6490,10 @@ def test_affine_grid_3d(self): | |||
self.assertEqual(input_cpu.grad, input_gpu.grad) | |||
|
|||
def test_channel_shuffle(self): | |||
device_list = ['cpu'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can move this test to TestNNDeviceType
to parameterize over device rather than using a device_list
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @isdanni for the fix. I modified the PR title slightly to avoid giving the impression that a CUDA kernel had been added for ChannelShuffle :)
I'm not sure whether you have any interest here but I am curious whether you would be interested in adding a ModuleInfo for torch.nn.ChannelShuffle
.
At a high level, ModuleInfo
s allow a more centralized testing framework for nn.Module
, each ModuleInfo in the module_db over here has an associated sample_inputs function and tests in test_modules.py are run over each the sample_inputs for each module.
I can provide more detail if you would be interested. But for this PR just moving the test to the TestNNDeviceType
class is sufficient :)
…rch#105351) Summary: Pull Request resolved: pytorch#105351 Include GPU support for `nn.ChannelShuffle` & update test. Test Plan: Please see GitHub Actions. Differential Revision: D47523764 fbshipit-source-id: 70c6c7e385386adf3b2dcec25003ab42a3ed0121
7823b35
to
5afad35
Compare
This pull request was exported from Phabricator. Differential Revision: D47523764 |
Thanks for the quick review! I moved it under I'm interested in adding ModuleInfo for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@pytorchbot merge |
Merge startedYour 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 |
Just for my understanding, there is no cuda impl for channel shuffle in this diff. Then how is it allowing channel shuffle to run when input tensors are cuda tensors? Are you converting them to cpu tensors somewhere? |
@kimishpatel adding
in native_functions allows the CPU impl to be run for CUDA tensors is my understanding, so this doesn't actually add a CUDA impl but just prevents ChannelShuffle from erroring out if it is passed inputs that are on CUDA. Does that sound reasonable to you? |
Right. I understood that, but what I dont understand is what happens when you actually dispatch to CPU impl. Shouldnt it error out then? |
Summary: Pull Request resolved: pytorch#106525 Add ModuleInfo for torch.nn.ChannelShuffle: pytorch#105351 (review) Test Plan: Please see GitHub Actions. Differential Revision: D48021100 fbshipit-source-id: d00d20c631e9d8f261239305343d07ae70f55b54
Summary: Include GPU support for
nn.ChannelShuffle
& update test.Fix: #104603
Test Plan: Please see GitHub Actions.
Differential Revision: D47523764