pytorch查看gpu信息,gpu是否可用
import torch
gpu_use= torch.cuda.is_available()
print(gpu_use)
# Decide which device we want to run on
device = torch.device("cuda:0" if (torch.cuda.is_available()) else "cpu")
print(device)
print(torch.cuda.get_device_name(0))