W1 - Exercise 3 - trouble with matrix sizes

I think I am using np.dot wrongly. It would be constructive if the course teaches more about it. It’s the basis.
The error is “ValueError: shapes (5,10) and (5,10) not aligned: 10 (dim 1) != 5 (dim 0)” on c_next calculation above:

{moderator edit - solution code removed}

That error means one of two things:

  1. Your input objects are the wrong shape.
  2. You are interpreting the math formulas incorrectly. It’s important to understand the notational convention that Prof Ng uses, which is described on this thread.

If you are talking about lstm_cell_forward, note that the formula for c_next does not involve dot products, which you’ll see from the point made about the notation on that thread that I linked.

1 Like

Thank you for the insightful explanation.

1 Like