Broadcasting Issue even when the code is correct!

I have been at this for hours, I have checked my code many times in each cell even printed out the shape for w,X. But why is the test case using (2,2) for weights ?

It shouldn’t be that shape.

Perhaps there is an error in your initialize_with_zeros() function. That’s the first place to look.

Yes, there are several problems there. Note that it’s talking about the result of w^T \cdot X and b: that’s where broadcasting comes into effect. So how can b end up being 2 x 2? It should be a column vector, right?

I’ve seen this syndrome before and my guess is that it is your “update parameters” logic in optimize that is wrong. You’re probably using dw to update b. A classic “copy/paste” error.

The bug is not in propagate: it failed because optimize passed it bad arguments. The bug is in optimize.

I found the code this was the line: b = w - learning_rate * db. Thank you

2 Likes