Solved by ljj7975 in post #4 
              
              
                I actually found out why I got so confused. 
without dilation, 
out = (in + 2*p - k)/s + 1 
however, with dilation new kernel size k_d = d * (k-1) + 1, 
Plugging this back into the above formula we have 
out = (in + 2p - k_d)/s + 1 
= (in + 2p - (d * (k-1) + 1))/s + 1 
= (in + 2*p - d * (k-1) - 1)/s…