File size: 266 Bytes
7d22699 |
1 2 3 4 5 6 7 8 9 |
import torch
# set device to mps if avaliable, cude if avaliable, cpu otherwise
device = torch.device("mps" if torch.backends.mps.is_available() else "cuda:0" if torch.cuda.is_available() else "cpu")
print (device)
x = torch.zeros(1, device=device)
print (str(x))
|