Not sure what I am doing wrong here. Also would this work with np.multiply?

ValueError: shapes (4,3) and (4,3) not aligned: 3 (dim 1) != 4 (dim 0)

*{moderator edit - solution code removed}*

Not sure what I am doing wrong here. Also would this work with np.multiply?

ValueError: shapes (4,3) and (4,3) not aligned: 3 (dim 1) != 4 (dim 0)

*{moderator edit - solution code removed}*

It looks like you are talking about the Week 3 Planar Data Assignment, although you don’t explicitly mention that.

Your implementation of dZ1 is incorrect. I think you are missing the convention that Prof Ng uses to distinguish between elementwise multiplication ("*") and dot product. Here’s a thread which discusses that. After reading that, please have another look at the formula given in the instructions for computing dZ1. There is one dot product involved and one elementwise multiplication, but you used dot product for both.

1 Like