Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
2a3a9a00
Unverified
Commit
2a3a9a00
authored
May 08, 2021
by
Quan (Andy) Gan
Committed by
GitHub
May 08, 2021
Browse files
[Bugfix] to() method ignores PyTorch default CUDA device (#2897)
parent
bfef789e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
python/dgl/backend/pytorch/tensor.py
python/dgl/backend/pytorch/tensor.py
+1
-1
No files found.
python/dgl/backend/pytorch/tensor.py
View file @
2a3a9a00
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment