'Same' convolution in pytorch

There are formulas for this. You can see a worked out example here:

also here is a reference for arithmetic of convolutions:


Though I agree that this so staandard that Pytorch should just have a layer or an option that calculates all this once for the user. It seems silly and repetitive that we have to think about this every time we want to use same convolution. Would be nice if the code was already ready and provided for us, specially for standard things like this.


1 Like