Just wanted to illustrate the answer given by @ghchoi. Because I had a little trouble following it.
I want to fit an image from standard mnist of size (N,1,28,28) into LeNet (proposed way back in 1998) due to kernel size restriction expects the input to be of the shape (N,1,32,32). So suppose we try to mitigate this problem by padding.
before padding
before padding a single image, it is of the size (1,28,28).
Thus we have three dimensions.

after padding
after padding , to create an image of size (1,32,32). Notice the pad=(2,2,2,2,0,0)
This is because I added two zeros to the x axis before and after the first (2,2) and two zeros after yaxis (2,2), leaving the channel column alone thus (0,0). value indicates that the padding would be 0.

Thanks!