pytorch1.0.1版本问题之AttributeError:module ‘torch.nn‘ has no attribute ‘Hardwish‘

报错:

AttributeError:module 'torch.nn' has no attribute 'Hardwish'

pytorch1.0.1版本问题之AttributeError:module ‘torch.nn‘ has no attribute ‘Hardwish‘_第1张图片

 我怀疑是因为pytorch的版本太低了,因为我的pytorch是1.0.1的

pytorch1.0.1版本问题之AttributeError:module ‘torch.nn‘ has no attribute ‘Hardwish‘_第2张图片

 而师兄的是1.9.0版本的,所以可以

pytorch1.0.1版本问题之AttributeError:module ‘torch.nn‘ has no attribute ‘Hardwish‘_第3张图片

解决方法:

Anaconda中新建一个虚拟环境,重新安装一个pytorch1.9.0

#cuda 10.2 也可以用在cuda10.0
conda install pytorch==1.9.0 torchvision==0.10.0 cudatoolkit=10.2 -c pytorch

conda install pytorch==1.9.0 torchvision==0.10.0 cudatoolkit=10.2 -c pytorch

终于1个小时左右安装完成

pytorch1.0.1版本问题之AttributeError:module ‘torch.nn‘ has no attribute ‘Hardwish‘_第4张图片

去试试还会报错不!

试过之后:

不会报错 'torch.nn' has no attribute 'Hardwish'

经过调试就可以跑通代码了~

你可能感兴趣的:(深度学习,python,pytorch,深度学习,神经网络)