First test case is failing, I have tried checking the shape and using a_prev_pad inside loop for assigning a_slice_prev
Check whether you are using stride correctly when you compute the start and end indices.
Exactly as Tom says, there is a problem with how you are handling the stride. The fact that your Z[0,2,1] value is zero most likely means that you included the stride
as a “step” in the “range” expression of the for
loops over h and w. That is a mistake. The for
loops are over the output space and you must touch every value there and not skip any. The striding happens in the input space. So at each iteration of the loops you use the stride
value to calculate vert_start
and horiz_start
in the input space.