znxlwm / pytorch-generative-model-collections

Collection of generative models in Pytorch version.
2.6k stars 548 forks source link

[bug report] wrong implementation of gradient clip in WGAN? #31

Open KK666-AI opened 3 years ago

KK666-AI commented 3 years ago

Dear author,

Thanks for your friendly implementation of popular GANs. I am reading your implementation of Wasserstein GANs, and notice that the gradient clip operation is placed after optimizer.step as seen in this line. Typically, in pytorch, the gradient operation is placed before the optimizer step.

pls have a check.

Wuziyi616 commented 2 years ago

As you can see in this line for p in self.D.parameters(): this is not performing gradient clipping but params value clipping