How to get "image gradient" in PyTorch?

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.

1 Like