I would suggest to set all the gradients to 0 then run a backward on your output. If it’s a Tensor, you can backward a tensor full of ones of the same size as the output. Then check the value of each parameters’ gradients. The ones that are non zero have an impact on the output.