Why did you only multiply Discriminator loss by 0.5?
def backward_D_basic(self, netD, real, fake):
# Real
pred_real = netD(real)
loss_D_real = self.criterionGAN(pred_real, True)
# Fake
pred_fake = netD(fake.detach())
loss_D_fake = self.criterionGAN(pred_fake, False)
# Combined loss
loss_D = (loss_D_real + loss_D_fake) * 0.5
# backward
loss_D.backward()
return loss_D
For lsgan, multiply both D and G by 0.5. But you did not.
Why? Is there a difference in the results?
0.5 applies to both LSGAN and DCGAN. criterionGAN is a class for both objectives. 0.5 should make no big difference. In practice, we divide the objective by 2 while optimizing D, which slows down the rate at which D learns relatively to G.
Most helpful comment
0.5 applies to both LSGAN and DCGAN. criterionGAN is a class for both objectives. 0.5 should make no big difference. In practice, we divide the objective by 2 while optimizing D, which slows down the rate at which D learns relatively to G.