Skip to content

Commit a38749d

Browse files
Atcoldapaszke
authored andcommitted
Fix cuda notes
Target GPU *is* consisten with source GPU
1 parent a909131 commit a38749d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/source/notes/cuda.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ Below you can find a small example showcasing this::
2929
b = torch.FloatTensor(1).cuda()
3030
# a.get_device() == b.get_device() == 1
3131

32+
c = a + b
33+
# c.get_device() == 1
34+
3235
z = x + y
33-
# z.get_device() == 1
36+
# z.get_device() == 0
3437

3538
# even within a context, you can give a GPU id to the .cuda call
36-
c = torch.randn(2).cuda(2)
37-
# c.get_device() == 2
39+
d = torch.randn(2).cuda(2)
40+
# d.get_device() == 2
3841

3942
Best practices
4043
--------------

0 commit comments

Comments
 (0)