How to write an new convolution operator in pytorch

I’m afraid you have to implement the convolution yourself in python using the already available pytorch functions as the Convolutions are implemented in C.

Alternatively you could have a look at the C-Implementation which can be found here and check whether it would be easier to modify this implementation. On this tutorial page you can find examples towards how to extend pytorch.

I think the best approach would be to write your own autograd function as suggested in this post

2 Likes