Skip to content

Commit

Permalink
[Bugfix] to() method ignores PyTorch default CUDA device (dmlc#2897)
Browse files Browse the repository at this point in the history
  • Loading branch information
BarclayII authored May 8, 2021
1 parent bfef789 commit 2a3a9a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/dgl/backend/pytorch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def device_type(ctx):
def device_id(ctx):
ctx = th.device(ctx)
if ctx.index is None:
return 0
return 0 if ctx.type == 'cpu' else th.cuda.current_device()
else:
return ctx.index

Expand Down

0 comments on commit 2a3a9a0

Please sign in to comment.