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 8710e90 commit f041c07Copy full SHA for f041c07
beginner_source/basics/quickstart_tutorial.py
@@ -87,7 +87,7 @@
87
# operations in the neural network, we move it to the GPU if available.
88
89
# Get cpu or gpu device for training.
90
-device = "cuda" if torch.cuda.is_available() else "cpu"
+device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
91
print(f"Using {device} device")
92
93
# Define model
0 commit comments