W1poolforward ValueError

Getting this error
ValueError: zero-size array to reduction operation maximum which has no identity
When I slice A_prev similar to the problem before with the vertstart etc…

I cant figure out what is going wrong. if I instead slice with :,:,: it is fine but everything is the same so it fails tests.

Are you sure you are looping over the output volume? Compare your logic to what you did in conv_forward. It’s not exactly the same because the channels are preserved here, but it’s pretty similar.

If nothing jumps out at you from that code comparison, try just putting a print statement to show the shape of your “sliced” version of A_prev each iteration of the loop before you do the np.max. Does it go off the rails on the very first iteration or only when you get to the end of one of the loops?

FWIW I added that print statement and here’s what I get on both the stride 1 and stride 2 test cases:

a_prev_slice.shape (3, 3)
a_prev_slice.shape (3, 3)
a_prev_slice.shape (3, 3)
a_prev_slice.shape (3, 3)
a_prev_slice.shape (3, 3)

And this is consistent all the way through.

Thanks apparently I forgot the i var in the slice