Pytorch报错:LSTM object has no attribute ‘_flat_weights‘

保留现场

……

探究原因

pytorch、torchvision版本太新,需要降到torch==1.3.1

解决方法

pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html

但是会报错如下:

Could not find a version that satisfies the requirement torch==1.3.1+cpu (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2) ERROR: No matching distribution found for torch==1.3.1.+cpu

这是因为python版本不匹配,我用的是Python3.8,需要降到Python3.7!

你可能感兴趣的:(BUG,pytorch,lstm,深度学习,rnn)