Value Error in Week 3 Exercise 4 (forward propoagation)

Hi, Khushboo.

If you are getting this dimensional error then try checking the equations that you are calling for the functions. Use dimensional analysis theory. Start from ‘Z1’, which is throwing errors in ‘A1’ and resulting in errors in ‘Z2 & A2’.

This link could be useful to you.

1 Like

It looks like you are using elementwise multiply "*" in the “linear activation” calculations. That is not what the math formula tells you to do. It is important to realize the notational convention that Prof Ng uses: when he writes a math formula with two operands adjacent with no explicit operator, then the operation there is “dot product” (np.dot), not elementwise multiply. When he means elementwise, he will always explicitly use “*” as the operator. So this formula:

Z = WA + b

Really means this:

Z = W \cdot A + b

Here’s a thread which discusses this point in more detail.

1 Like

Thanks. Got the error solved… The link helped a lot. I am able to correct other mistake in the code too…

Thanku so much. I am able to understand well.