Dynamic/variable convolution kernel/filter for image smoothing/blurring

I would like to smooth/blur each part of an image to an extent dependent on a separate input tensor specific for that image.
So, depending on the part of the given input tensor I can smooth the corresponding part of the image.

Is there a way to do this using Conv2d/Unfold/Fold functional calls? Or another way?

It seems like I need a conv function with dynamic kernel weights?

Could you explain how the separate input tensor look like and how a “part of the given input tensor” would be used to smooth the image?

Generally you can use the functional API via F.conv2d to apply a kernel on an image tensor, but I’m unsure about the aforementioned aspects.

I think I figured it out but I need to make it less expensive! Thanks!