@ptrblck Thanks for the response! So if I understand correctly, gradients of the computation graph of generator are cleared before every iteration automatically?
I also came across this (link):

PyTorch uses a dynamic graph. That means that the computational graph is built up dynamically, immediately after we declare variables. This graph is thus rebuilt after each iteration of training.

Is this the reason? I am planning to run the 2 experiments soon, but just for sake of understanding, it would be good to know how exactly the computation graphs and gradients work