Basically, it does exactly what you specify. The used numpy function appends values in each dimension. The amount of "pads" on each axis is specified by ((0,0),(2,2),(2,2),(0,0))
, given the dimension of your dataset, which is:
10000 (samples) x 28 (image dimension 1) x 28 (image dim. 2) x 1 (grayscale value!)
Now let's see what your specification means in that regard:
(0,0)Pad 0(as in the amount) values before and after each row
(2,2)Pad 2 before and 2 after each value of dim. 1 of your image data: 28 values -> 32
(2,2)Pad 2 before and 2 after each value of dim. 2 of your image data: 28 values -> 32
(0,0)Pad, again, nothing in the grayscale value dimension
That means you will end up with a 32x32 image in the respective dimension. Now, the only thing that's left is: Which values do we pad? The answer is quite simple, you do not specify any constant_values
, meaning it will pad with the default constant_values
(which is specified on the above linked page). Namely this value is 0.
To sum it up, simply imagine you have a 32x32 image, your 28x28 is in the middle, and on the outside you have a 2-value-thick border of 0's.