File size: 254 Bytes
f98cc3f |
1 2 3 4 5 6 7 8 9 10 |
import torch
def get_device():
"""
Determine the available device for computation.
Returns either CUDA device if available, or CPU.
"""
if torch.cuda.is_available():
return torch.device('cuda')
return torch.device('cpu') |