pytorch官网
根据官网提示安装,选择pip方式安装即可(因为conda方式,切换到清华镜像也下载不下来)

注:
1、一定安装本机cuda对应的版本,否则GPU用不了。
我本机的CUDA是10.0版本,安装命令是
pip install torch==1.3.0+cu100 torchvision==0.4.1+cu100 -f https://download.pytorch.org/whl/torch_stable.html


https://download.pytorch.org/whl/torch_stable.html是必须的,国内可访问。
用命令torch.cuda.is_available()查看版本是否正确。

上图显示,gpu可用。下图说明没安装正确版本,gpu不可用

网友评论