Search code examples
deep-learningpytorchconv-neural-networkzero-padding

Same padding when kernel size is even


When the kernel size is odd, we can manually calculate the necessary padding to get the output in the same dimension as input such that it creates same padding.

But how can we calculate padding dimensions for kernels with even sizes (ex: (2x2)?


Solution

  • enter image description here

    I used padding as 1 and dilation as 2 which resulted same padding.