Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

retain_graph=True 相关问题 #98

Open
Kirito-E2D opened this issue Apr 28, 2021 · 2 comments
Open

retain_graph=True 相关问题 #98

Kirito-E2D opened this issue Apr 28, 2021 · 2 comments

Comments

@Kirito-E2D
Copy link

运行406_conditional_GAN时,出现以下错误:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [128, 1]], which is output 0 of TBackward, is at version 2; expected version 1 instead.
请问是什么原因?

@hfutball
Copy link

图片1
原因:在计算生成器网络梯度之前先对判别器进行更新,修改了某些值,导致Generator网络的梯度计算失败。
解决方法:按图修改该部分代码。

@Kirito-E2D
Copy link
Author

图片1 原因:在计算生成器网络梯度之前先对判别器进行更新,修改了某些值,导致Generator网络的梯度计算失败。 解决方法:按图修改该部分代码。

运行成功啦!谢谢!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants