Week-1 Exercise-3 Forward Pass

Hey, I’ve been dealing with the following error in exercise 3 conv_forward(). Would be great if someone could give some hints here.

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

The error is pointing on the Z[i, h, w, c] = ... line and the s =... from the conv_single_step() function

Thank you!

hi @Salwyn13 ,

I think there is some confusion here. We are in the “Course 3” category, but I guess your question is related to course 4 “Convolutional Neural Networks”, is that right? I would suggest to move your post to the right category, so that the appropriate mentor can support you.

Have a great day!

Oh, sorry. Just noticed. Thanks for informing :grinning:

1 Like

The conv_single_step() function should be passed parameters of a_slice_prev, weights, and biases.
In conv_single_step(), you should use np.multiply() with parameters of W and a_slice_prev.

Thanks for replying @TMosh. That’s exactly what I did.

What are you using for the ranges of h, w, and c?
Does your code for horizontal and vertical starts and ends give values that are in the correct ranges?