C4 week1 Assignemnt 1 conv_forward

I have tried many times but still get this problem, IndexError: index 4 is out of bounds for axis 2 with size 4

{moderator edit - solution code removed}

It is a mistake to implement the stride in the “range” of the loops over height and width. The way to think of this is that the stride is happening in the input space, but the loops are over the output space, right? You have to touch each position of the output space and not skip any. The skipping happens in the input, so the stride is used to compute vert_start and horiz_start.

1 Like