首先打开anaconda prompt,激活对应虚拟环境。
导入torch并获取对应版本
python
import torch
torch.__version__

导入torchvision并获取对应版本
python
import torchvision
torchvision.__version__

检查cuda是否可用
python
torch.cuda.is_available()

获取CUDA设备数
python
torch.cuda.device_count()

获取当前cuda设备id
python
torch.cuda.current_device()

获取CUDA设备名称
python
torch.cuda.get_device_name(0)
