"tests/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "1a8e0c00a9de0234ea01fa09db4aca2e60f4ee0f"
Unverified Commit 2a3a9a00 authored by Quan (Andy) Gan's avatar Quan (Andy) Gan Committed by GitHub
Browse files

[Bugfix] to() method ignores PyTorch default CUDA device (#2897)

parent bfef789e
...@@ -86,7 +86,7 @@ def device_type(ctx): ...@@ -86,7 +86,7 @@ def device_type(ctx):
def device_id(ctx): def device_id(ctx):
ctx = th.device(ctx) ctx = th.device(ctx)
if ctx.index is None: if ctx.index is None:
return 0 return 0 if ctx.type == 'cpu' else th.cuda.current_device()
else: else:
return ctx.index return ctx.index
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment