You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
Thank you for your great work. However, I think you should add set_requires_grad(net_d, True/False) for discriminator during training. Is it true?
modified code:
# (1) Update D network
######################
set_requires_grad(net_d, True) # add it here
optimizer_d.zero_grad()
# train with fake
fake_ab = torch.cat((real_a, fake_b), 1)
pdb.set_trace()
pred_fake = net_d.forward(fake_ab.detach())
loss_d_fake = criterionGAN(pred_fake, False)
# train with real
real_ab = torch.cat((reala, real_b), 1)
pred_real = net_d.forward(real_ab)
loss_d_real = criterionGAN(pred_real, True)
# Combined D loss
loss_d = (loss_d_fake + loss_d_real) * 0.5
loss_d.backward()
optimizer_d.step()
set_requires_grad(net_d, False) # add it here
######################
I am looking forward to hearing from you. Thank you in advance!
The text was updated successfully, but these errors were encountered:
Hello,
Thank you for your great work. However, I think you should add set_requires_grad(net_d, True/False) for discriminator during training. Is it true?
modified code:
I am looking forward to hearing from you. Thank you in advance!
The text was updated successfully, but these errors were encountered: