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)?
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)?
note these the 2 formula's
lets assume u have i/p dimension of 28x28, and you want same padding implies your o/p dimension to be same i.e 28x28. and i am assuming your stride as 1
let us come to calculation of padding amount, pad = (2 - 1) / 2 = 1 / 2 substituting this value to equation 2)
o/p feature map=(28 - 2 + 2(1/2))/1 + 1 =28
Hence the last answer is your dimension of your o/p feature map,(hence verified)
I used padding as 1 and dilation as 2 which resulted same padding.