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

[PyTorch] Use new cuda semantics #270

Closed
tabergma opened this issue Nov 29, 2018 · 0 comments · Fixed by #402
Closed

[PyTorch] Use new cuda semantics #270

tabergma opened this issue Nov 29, 2018 · 0 comments · Fixed by #402
Assignees
Labels
enhancement Improving of an existing feature

Comments

@tabergma
Copy link
Collaborator

As described in the CUDA semantics by PyTorch we should use

device = None
if torch.cuda.is_available():
    device = torch.device('cuda')
else:
    device = torch.device('cpu')

x = torch.empty((8, 42), device=device)
net = Network().to(device=device)

instead of

x = torch.empty((8,42))
if torch.cuda.is_available():
    x = x.cuda()
@tabergma tabergma added the enhancement Improving of an existing feature label Nov 29, 2018
tabergma added a commit that referenced this issue Dec 13, 2018
tabergma added a commit that referenced this issue Dec 13, 2018
@tabergma tabergma self-assigned this Dec 13, 2018
tabergma added a commit that referenced this issue Dec 14, 2018
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
tabergma added a commit that referenced this issue Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving of an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant