原先pytorch 是在官網下載的 pytorch1.4+cud9.2
但是在運行一個代碼時加載的預訓練參數模型是pytorch1.0版本的
因爲版本不匹配所以在運行時報錯
'AvgPool2d' object has no attribute 'divisor_override'
解決無果 只能降低自己的pytouch版本到1.0
卸載torch1.4+cud9.2 和 torchvision0.6.0+cud9.2
pip uninstall torch
pip uninstall torchvision
查詢官網pytorch 匹配的cuda 只能是9.0 但是我本機是9.2
先安裝
pytorch 各個包下載地址
https://download.pytorch.org/whl/cu92/torch_stable.html
離線下載
https://download.pytorch.org/whl/cu90/torch-1.0.0-cp36-cp36m-win_amd64.whl
cmd pip 安裝
然後pip 安裝對應的torchvision==0.2.1
然後因爲pytorch1.0.0 對應的cuda 是9.0 本機是9.2 去測試是否可以用
import torch
#查看torch版本
# print(torch.__version__)
#查看torch對應version
# print(torch.version.cuda)
#查看cuda是否可用
# print(torch.cuda.is_available())