Custom structured kernel

Greetings
Is there a standard way to train a convolutional kernel where the kernel has a particular structure, for my specific example, I’d like the kernel to be rotationally symmetric:

c b c
b a b
c b c

And more generally, I’d like to be able to create a function F parametrized by (a_0, a_1,…) such that the kernel is just F applied to the elements of a matrix of the distances (squared) from the center of the kernel. Then I’d like the parameters (a_0, a_1,…) to be trained directly.
I’ve tried guessing so far but without success.

Hello,
Although I haven’t done this myself, I found several threads on the forum.
How to implement a custom convolutional layer and call it from your own network? - PyTorch Forums
Custom convolution layer - PyTorch Forums
I believe there is no better way than writing your own class, this class should be based on nn.Module.

Hope I have helped.