编写代码,pytorch出现了这个问题:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 64, 92, 122]], which is output 0 of LeakyReluBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!
在网络forward函数中,不要出现x+=1,使用x=x+11
比如我的代码原来是这么写的:error
改成这样之后就可以运行了
https://blog.csdn.net/DuinoDu/article/details/80435127 ↩︎