报错提示:RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [128, 1]], which is output 0 of TBackward, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
必须记录一下 一天了 一直卡在这个报错上
网上查到的解决方案:
解决方案1:把所有的inplace=True改成inplace=False
解决方案2:将out+=residual这样所有的+=操作,改成out=out+residual
但是都不行
最后看到了一个帖子帖子本人
尝试了一下 就解决了
解决方法:
降低pytorch版本
我的pytorch版本是1.6.0 降为1.4.0就好用了
作为一个小白 anaconda降版本特别慢 于是用了清华镜像源
如何降版本 查看版本信息 找到了两个很好的博客 放在下方 作为参考。
如何降低版本 及清华镜像源地址 讲解的很清楚