Solved by richard in post #2 
              
              
                Assuming model is a nn.Module, you could use .parameters(): 
grads = [x.grad for x in model.parameters()]
# do things with these grads