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 d90487f commit 741d46bCopy full SHA for 741d46b
recipes_source/compiling_optimizer.py
@@ -44,6 +44,17 @@
44
# In this example, we'll use the Adam optimizer
45
# and create a helper function to wrap the step()
46
# in torch.compile()
47
+#
48
+# .. note::
49
50
+# torch.compile is only supported on cuda devices with compute capability >= 7.0
51
+
52
+# exit cleanly if we are on a device that doesn't support torch.compile
53
+if torch.cuda.get_device_capability() < (7, 0):
54
+ print("Exiting because torch.compile is not supported on this device.")
55
+ import sys
56
+ sys.exit(0)
57
58
59
opt = torch.optim.Adam(model.parameters(), lr=0.01)
60
0 commit comments