Pytorch :Trying to backward through the graph a second time, but the buffers have already been freed
最近在学习Pytorch,刚用Pytorch重写了之前用Tensorlfow写的论文代码。首次运行就碰到了一个bug:Pytorch-RuntimeError:Tryingtobackwardthroughthegraphasecondtime,butthebuffershavealreadybeenfreed.Specifyretain_graph=Truewhencallingbackward