Cek GPU Macbook M-series bisa digunakan di PyTorch#
import torch
if not torch.backends.mps.is_available():
if not torch.backends.mps.is_built():
print("MPS not available because the current PyTorch install was not built with MPS enabled.")
else:
print("MPS not available because the current MacOS version is not 12.3+ and/or you do not have an MPS-enabled device on this machine.")
t = torch.tensor([1, 2, 3], device='mps'); t
tensor([1, 2, 3], device='mps:0')