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)) | |