Solved by tux in post #2 
              
              
                After applying generator_loss.backward() you can access the gradient with input.grad. See gradient section of https://pytorch.org/tutorials/beginner/blitz/autograd_tutorial.html#sphx-glr-beginner-blitz-autograd-tutorial-py for instance.