Solved by albanD in post #2 
              
              
                Hi, 
You can set requires_grad=True on the input before feeding it to the network. That way after the backward pass you can check it’s .grad field to get the gradients.