Can't get past "zero_pad_test" failed assertion

My zero_pad function seems to return the correct zero-padded matrix (a layer of 0s around all the dimensions). From a (4,3,3,2) image to a (6,5,5,4) zero-padded version of the image. The assertion in zero_pad_test compares the (6,5,5,4) with a different shape, (4,9,9,2). Is there actually an error in my zero_pad function? Or, should I just continue past this test?

The padding should only affect the h and w dimensions, right? Not the “samples” dimension or the “channels” dimension.

Also note that the test case uses a pad value of 3, so that means it adds 6 (3 on either side) to both the height and width dimensions. So if those are 3 x 3 as they are in the test input, then that is why they become 9 x 9. It looks like your logic must ignore the value that is passed in and always use 1 as the pad value.

1 Like

Thanks! You’re right, I didn’t use the “pad” factor, rather the default. Also, I didn’t pay enough attention to the description of the return padded image.