import torch
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print(device)
Pytorch:检验本地GPU是否可用
最新推荐文章于 2024-10-08 17:00:04 发布
import torch
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print(device)