DMIT icon indicating copy to clipboard operation
DMIT copied to clipboard

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

Open YuheD opened this issue 3 years ago • 3 comments

/DMIT/models/base_model.py", line 246, in update_model errDec_total.backward(retain_graph=True) RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [8, 256]] 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).

Anybody has this question?

YuheD avatar Feb 20 '21 06:02 YuheD

I encountered a same problem as yous. My pyotrch version is 1.7.1+cu101. Have you solved the problem

lknownothing avatar Feb 23 '21 05:02 lknownothing

Please downgrade your pytorch version to pytorch<=1.4. I will refactor the code in the near future to support the new version of pytorch.

Xiaoming-Yu avatar Mar 02 '21 02:03 Xiaoming-Yu

你好,作者,我也遇到相同的问题,目前使用的是pytorch1.7,当前的显卡最低就支持CUDA11,支持的最低版本Pytorch就是1.7,很难降低版本,请问作者有什么好的解决方案吗,谢谢!

Idea89560041 avatar Apr 17 '22 07:04 Idea89560041