Skip to content

Commit f041c07

Browse files
authored
Add support of mps for Mac M1 CPUs (#2165)
1 parent 8710e90 commit f041c07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beginner_source/basics/quickstart_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
# operations in the neural network, we move it to the GPU if available.
8888

8989
# Get cpu or gpu device for training.
90-
device = "cuda" if torch.cuda.is_available() else "cpu"
90+
device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
9191
print(f"Using {device} device")
9292

9393
# Define model

0 commit comments

Comments
 (0)