Skip to content
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

Fixed device conversion method #887

Merged
merged 1 commit into from Apr 5, 2020

Conversation

bendboaz
Copy link
Contributor

@bendboaz bendboaz commented Apr 5, 2020

Fixes #886

Description:
Fixed bug from #886 where device #0 was considered "None" and no conversion was performed.
Three words added to the code overall, so no tests/docs added.

Check list:

  • New tests are added (if a new feature is added)
  • New doc strings: description and/or example code are in RST format
  • Documentation is updated (if required)

Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bendboaz thanks for the PR!
Thinking more on the snippet of #886 it seems like passing device as int is a legacy usage : https://pytorch.org/docs/stable/tensor_attributes.html#torch.torch.device

However, explicit checking of device is None is OK.

@vfdev-5 vfdev-5 merged commit 5e05252 into pytorch:master Apr 5, 2020
@bendboaz
Copy link
Contributor Author

bendboaz commented Apr 5, 2020

Definitely, and my fix for this (in my code, not in the PR) was actually moving to the correct definition of devices. Anyways, you're right on both accounts :)

P.s really excited, that's my first time adding to an OS project. Thanks for the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

utils.convert_tensor considers device = 0 to be no device
2 participants