File size: 427 Bytes
02ac88d | 1 2 3 4 5 6 7 8 9 10 | import torch
print(f"PyTorch version : {torch.__version__}")
print(f"CUDA available : {torch.cuda.is_available()}")
print(f"GPU : {torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'None — using CPU'}")
# Quick tensor op on GPU
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
x = torch.randn(3, 224, 224).to(device)
print(f"Test tensor on : {x.device} — shape {x.shape}") |