Ahmed_m:

Yes, but what about the second call to backward function for optimizing the generator?


The generator update does not have a second backward call. Could you point me to the line of code?
While optimizing the discriminator, you won’t compute any gradients in the generator.
Since the fake input was detached from the generator, no gradients will be created in the generator itself.
You can check it by calling print(netG.some_layer.weight.grad) after the discriminator was updated (in the first iteration, otherwise you might see the gradients from the previous run).