I have a tensor which has empty values. I want to apply a 2d blurring convolution kernel just to the non-empty values. For simplicity let’s assume kernel weights are all equal.
Maybe something like dynamic kernel weights, so kernel weights = 1/n, where n is the number of valid pixels in the region.
Is there currently pytorch functionality which supports something like this?
I think you can just apply a convolution using a mask. In the end a convolution is product + sum between the elements the kernel and the tensor. If you just multiply your tensor by a binary mask (ones for the non-empty values and zeros for empty values) the result should be that.