File size: 265 Bytes
2086153
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import torch

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

print(f"Using device: {device}")

if torch.cuda.is_available():
    print(f"CUDA device name: {torch.cuda.get_device_name(0)}")
else:
    print("No CUDA device available")