I'm trying to use a kernel filter in my custom loss, to help to identify pixels continuity (lines).
I want to apply this kernel to value line-like shapes and depreciate blocks of pixels.
For example, I want to use kernels for image processing, like this link of Wikipedia.
https://en.wikipedia.org/wiki/Kernel_(image_processing)
Then, my idea is to use a kernel that steps over the tensor, with stride 1 and padding 1, like it happens with a convolution operation.
But I don't know how to do that or if it is possible.
I tried to use regular operations, like pad, foldl and roll, but I don't know if it is the correct and best way to do it.
Best regards,