-
Notifications
You must be signed in to change notification settings - Fork 26.3k
add to method for PackedSequence
#7319
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 to method for PackedSequence
#7319
Conversation
cf4f997 to
b0692f9
Compare
b0692f9 to
d3865ac
Compare
test/test_nn.py
Outdated
| self.assertIs(a, a.to('cpu', dtype=torch.int32)) | ||
| self.assertEqual(a.long(), a.to(torch.int64)) | ||
|
|
||
| if torch.cuda.data.is_available(): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/nn/utils/rnn.py
Outdated
| return type(self)(self.data.byte(), self.batch_sizes) | ||
|
|
||
| def to(self, *args, **kwargs): | ||
| r"""Performs dtype and/or device conversion on `self.data`""" |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@ssnl Thanks for your review. I think I have resolved both your comments, could you take a look again? |
test/test_nn.py
Outdated
| self.assertEqual(a.long(), a.to(torch.int64)) | ||
|
|
||
| if torch.cuda.is_available(): | ||
| for cuda in ['cuda', 'cuda:0' if torch.cuda.data.device_count() == 1 else 'cuda:1']: |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
By the way, you can also look at the CI logs to see the failures. |
|
@ssnl Thank you for your help. |
ssnl
left a comment
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.
LGTM. Thanks @facaiy !
* ENH: add to method for PackedSequence * ENH: return self if possible * TST: remove extra data * DOC: add more explanation * TST: remove extra data * DOC: minor fix
Fix #7221.
It's my first contribution to pytorch, so any help would be appreciated. Thanks.