How to implement multiple different kernel shapes

If you want to experiment with the kernels and be flexible, I would recommend to stay on the Python side for now and use torch.unfold to create the patches as described here. Once you have the patches, you can apply your custom conv operation, reshape it back etc.

If you really want to manipulate the backend implementation, convolutions are dispatched here.

1 Like