Pytorch 笔记

环境

查看版本

python -c "import torch;print(torch.__verison__)"

判断 cuda 是否使用

python -c "import torch;print(torch.device('cuda' if torch.cuda.is_available() else 'cpu' ))"

查看显卡名称

python -c "import torch;print(torch.cuda.get_device_name(0))"