import torch
torch.cuda.current_device()
返回设备索引序列
torch.cuda.device_count()
返回设备数量
torch.cuda.get_device_name(0)
返回设备名称,从索引0开始
torch.cuda.is_available()
GPU是否使用
运行结果如下,也可以在import torch后直接使用第四条命令
import torch
torch.cuda.current_device()
返回设备索引序列
torch.cuda.device_count()
返回设备数量
torch.cuda.get_device_name(0)
返回设备名称,从索引0开始
torch.cuda.is_available()
GPU是否使用
运行结果如下,也可以在import torch后直接使用第四条命令