pytorch报错:RuntimeError: Trying to backward through the graph a second time
在进行Gan的训练过程中,经常会遇到这个问题:RuntimeError: Trying to backward through the graph a second time, but the saved intermediate results have already been freed这个错误的描述就是,你在进行方向传播的时候,缓存提前释放了,很多解决办法都是说在loss.backward() 改成loss.backward(retain_graph=True),实际上,大部分的代码问题不出在这里
原创
2021-09-24 21:28:35 ·
4734 阅读 ·
8 评论