import torch
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print(device)
Pytorch:检验本地GPU是否可用
最新推荐文章于 2025-02-26 20:38:28 发布
import torch
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print(device)