RuntimeError: one of the variables needed for gradient computation has been modified by an inplace o

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace o

我这找到的原因是有的变量需要加cuda(),我没加造成的。

解决方法二:如果有inreplace参数,设为False

解决方法三:报错原因是pytorch0.4.0版本后tensor不支持inplace操作了,所以把所有inplace错作去掉。

猜你喜欢

转载自blog.csdn.net/jacke121/article/details/81353042
今日推荐