js_reverse/ayf_ocr/02pytorch基础语法/判断用的是cpu运算还是gpu运算.py
2023-05-26 13:34:28 +08:00

5 lines
98 B
Python

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