版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiongchengluo1129/article/details/80583201
错误如下:
AttributeError: module ‘torch.nn’ has no attribute ‘LocalResponseNorm’
错误原因:
我在Windows装的pytorch是0.3.1。查看0.3.1的文档发现确实没有这个模块。
查看0.4.1的官方文档发现,有这个模块
class torch.nn.LayerNorm(normalized_shape, eps=1e-05, elementwise_affine=True)
所以更新pytorch版本:
pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.0-cp35-cp35m-win_amd64.whl
pip3 install torchvision
如下: