Xiaoming-Yu/DMIT

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

YuheD opened this issue · 3 comments

YuheD commented

/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?

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

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.

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