求pytorch大神解答,问题出在哪里

avatar
关注
报错提示:RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: ], 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).


阅读 54599

这些回复亮了

discusser-avatar

hupu历史理智第一人

· 江苏

在虎扑你甚至可以学会一门语言

亮了(25)
查看回复(3)
回复
discusser-avatar

zxlllccc

· 福建
何时身高190谢谢大佬,可以了,想问问原因是什么,求教收起

因为算G的loss的计算图是包含D的,但是你在G的backward之前更新了D的值,这时候再去计算就不是和forward时候对应的梯度了

亮了(21)
查看回复(2)
回复