Calculate the derivative of a nod in respect to an input image

I would like to calculate the derivative of any node in respect of image input to implement visualization methods using PyTorch.

Any suggestions ?