原先pytorch 是在官网下载的 pytorch1.4+cud9.2
但是在运行一个代码时加载的预训练参数模型是pytorch1.0版本的
因为版本不匹配所以在运行时报错
'AvgPool2d' object has no attribute 'divisor_override'
解决无果 只能降低自己的pytouch版本到1.0
1 | 卸载torch1.4+cud9.2 和 torchvision0.6.0+cud9.2 |
pip uninstall torch
pip uninstall torchvision
查询官网pytorch 匹配的cuda 只能是9.0 但是我本机是9.2
先安装
离线下载
https://download.pytorch.org/whl/cu90/torch-1.0.0-cp36-cp36m-win_amd64.whl
cmd pip 安装
1 | 然后pip 安装对应的torchvision==0.2.1 |
然后因为pytorch1.0.0 对应的cuda 是9.0 本机是9.2 去测试是否可以用
1 2 3 4 5 6 7 8 9 10 11 12 13 | <strong>import </strong>torch #查看torch版本 <em># print(torch.__version__) #</em><em>查看</em><em>torch</em><em>对应</em><em>version # print(torch.version.cuda) #</em><em>查看</em><em>cuda</em><em>是否可用</em> <em> # print(torch.cuda.is_available())</em> |