We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5887be6 commit 76011daCopy full SHA for 76011da
recipes_source/recipes/changing_default_device.py
@@ -35,14 +35,16 @@
35
print(mod(torch.randn(128, 20)).device)
36
37
#########################################
38
-# You can also set it globally like this:
+# You can also set it globally like this:
39
40
torch.set_default_device('cuda')
41
42
mod = torch.nn.Linear(20, 30)
43
print(mod.weight.device)
44
45
46
+torch.set_default_device('cpu')
47
+
48
################################################################
49
# This function imposes a slight performance cost on every Python
50
# call to the torch API (not just factory functions). If this
0 commit comments