quanglnt's picture
Add application files
8c36119
raw
history blame contribute delete
321 Bytes
import torch
def get_device():
if torch.cuda.is_available:
# print('cuda is available')
return 'cuda'
elif torch.backends.mps.is_available:
# print('mps is available')
return 'mps'
else:
# print('using cpu')
return 'cpu'
device = get_device()
# print(device)