1
$\begingroup$

Hi for my project I'm using a somewhat simple CNN consisting of several convolution layers and pooling layers. Essentially the model is trained to perform a blur of sorts on an input image.

For my project the gradients of the output pixels with respect to the input pixels is very important. I'm aware of how to get gradients for the output with respect to weights. But I am not sure how to do it with respect to input pixels.

Basically it will tell me how changing an input pixel effects the output!

I'm currently using pytorch but I dont mind using any package that could give me this functionality.

$\endgroup$

1 Answer 1

0
$\begingroup$

"But I am not sure how to do it with respect to input pixels." the same way you do it for the weights... you take your input tensor, you set requires_grad to True, you do the forward pass thus having an output $y = f(x)$, and you just do y.mean().backward(), and your input tensor will have the gradient saved in

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .