js_reverse/机器学习/02pytorch基础语法/判断用的是cpu运算还是gpu运算.py
2023-04-21 15:15:07 +08:00

5 lines
98 B
Python

import torch
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print(device)