Kornia library: Does not require grad and does not have a grad_fn

Dear all,
I’m using Kornia library in order to use some useful functions for my experiments.
However, I get always the same error when I try to compute the image generated by canny filters with another very similar (a simple MSE by PyTorch function).
I looked the code inside Kornia function (canny filter) and I noticed that the required_gradient attribute is empty.
I’m sure to feed a tensor image with gradient set True.
I’m new on Kornia and I will appreciate so much any useful suggestions…
Thanks a lot! :slight_smile:

required_gradient is not a tensor attribute, so you might want to replace it with requires_grad and make sure it’s set to True.

in principle the canny operator should work with back propagation

see also: kornia/test_canny.py at 0deb07968053a6f6dea38754b4167498ad59e7b7 · kornia/kornia · GitHub