Skip to main content

Checking PyTorch Configuration

Use the following code for testing

CUDA

import torch

# Print PyTorch version
print(torch.__version__)

# Check if CUDA (GPU) is available
print(torch.cuda.is_available())

MPS

import torch

# Print PyTorch version
print(torch.__version__)

# Check if MPS is available
if torch.backends.mps.is_available():
mps_device = torch.device("mps")
print("MPS device is available.")
else:
print("MPS device is not available.")

image-20240702135630993