Works like magic for Macbook Pro2019 with Intel Silicon, i9.
print("PyTorch is using", torch.get_num_threads(), "GPU threads.") device = torch.device("cuda" if torch.cuda.is_available() else "mps")