Skip to content

retain_graph=True 相关问题 #98

Open

Description

@Kirito-E2D

运行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.
请问是什么原因?

Activity

  1. Awesome-Paella commented on Feb 15, 2022

    @Awesome-Paella

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

  2. Kirito-E2D commented on Feb 15, 2022

    @Kirito-E2D
    Author

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

    运行成功啦!谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions