Backprop through custom layers

Can I use automatic differentiation over a custom convolution layer

eg. F.conv2d(images,weights,padding=1)
where weights here are some function of a trainable parameter a weights=f(a) ?

I think the weight here is a matrix with fixed size and it is initialized with a distribution. You could create an empty tensor and perform initialization function on it like this.

@MariosOreo, Thank you.