Week 1, Assignment 1 Exercise 3

When i do slicing a_slice_prev = A_prev_pad[i, vert_start:vert_end, horiz_start:horiz_end, :]

i get that error
Can anybody help?
Error:

---> 28     s = np.multiply(a_slice_prev, W)
     29     # Sum over all entries of the volume s.
     30     Z = np.sum(s)

ValueError: operands could not be broadcast together with shapes (2,3,9,4) (3,3,4)
1 Like

I’m sorry, but that can’t be the code that produced the result you are showing. Note that with the code you show, the first dimension of a_slice_prev would be 1, but it’s not, right?

The a_slice_prev should have only 3 dimensions. So you need to start by figuring out why it ended up with 4.

1 Like