convert output_device at data_parallel from torch.device to index#10189
convert output_device at data_parallel from torch.device to index#10189weiyangfb wants to merge 1 commit into
Conversation
weiyangfb
commented
Aug 2, 2018
- fixes torch.device and torch.nn.parallel.data_parallel compatibility #9984
|
@pytorchbot retest this please |
|
I believe there are some instances of the same case in |
|
@vishwakftw I see, I will change them as well |
| # test output_device | ||
| l = nn.Linear(10, 5).float().cuda() | ||
| i = Variable(torch.randn(20, 10).float().cuda()) | ||
| out = dp.data_parallel(l, i, (0, 1), torch.device('cuda')) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
6606483 to
d7c16b6
Compare
|
actually, can we add a test for the other two code paths as well? |
ssnl
left a comment
There was a problem hiding this comment.
The better fix is to make scatter, gather, parallel_apply, etc. to accept device objects (vs. converting to idx in DP). You can also make device_ids to support device objects this way.
|
ping @weiyangfb on @ssnl suggestion. |
|
you can probably use/adapt |
d7c16b6 to
c70b9d2
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
is this good to go? @ssnl |
c60a6a6 to
9e500da
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
25b90d1 to
4ed0d8f
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@ssnl would you like to take quick pass on this? The updates are separated test function and doc fixes. Thanks! |
ssnl
left a comment
There was a problem hiding this comment.
lgtm, but there is one remaining nit to be addressed
4ed0d8f to
3a4e211
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@ssnl I see, fixed more places with |
3a4e211 to
f360f36
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
…d APIs 1. convert torch.device to device.index in APIs 2. docs fixes
f360f36 to
d5721ff
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
weiyangfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
…torch#10189) Summary: - fixes pytorch#9984 Pull Request resolved: pytorch#10189 Differential Revision: D9545390 Pulled By: weiyangfb fbshipit-source-id: 3a6a705437553ba319e9fd4b7f676ff73857a27e