Hi,
I am playing with the DCGAN 209 code in pytorch examples .
Replacing errD_real.backward() 23 and errD_fake.backward() 13 with errD.backward() after Line 236 results in failure (get the nonsense output) in the training.
where errD = errD_real + errD_fake, but errD.backward() is not equal to errD_real.backward() and errD_fake.backward()
I think both of them should give me the same gradients, but in fact it does not. Does anyone know where the issue comes from? If the model has multiple losses, do we really need to call the backward function for each loss rather than “sum them up and then call the total_loss.backward”?