Coursera (Sequence Models): Building_a_Recurrent_Neural_Network_Step_by_Step

2 - Long Short-Term Memory (LSTM) Network

Do you think the answer is wrong?

concat = np.concatenate((a_prev, xt), axis=0)

output:
ft.shape, c_prev.shape, it.shape, cct.shape (5, 10) (5, 10) (5, 10) (5, 10)
$$$$$$$$$$$$ c_next.shape (5, 5)
ft.shape, c_prev.shape, it.shape, cct.shape (7, 8) (7, 8) (7, 8) (7, 8)
$$$$$$$$$$$$ c_next.shape (7, 7)

Have you posted in the right course?

I can not find right tag.

Because it is sequential model should align with NLP.

The Deep Learning Specialization - Course 5 (Sequence Models) also covers RNN’s. And it has a practice lab with that notebook file name.

Is that the course you are attending?

https://www.coursera.org/learn/nlp-sequence-models

https://www.coursera.org/learn/nlp-sequence-models/programming/yIJFK/building-your-recurrent-neural-network-step-by-step

In spite of the confusing name in the URL, that notebook is from DLS Course 5 “Sequence Models”, Week 1.

You can move your thread to that forum area by using the “pencil” icon in the thread title.

Sorry, whatever. Can you see my point? I believe there is something wrong with the exercise. Could you look at it?

2.1 - LSTM Cell

Exercise 3 - lstm_cell_forward

I’ll move your thread to the correct forum location.

This assignment has been used for quite a long time, without any issues reported. What specifically do you believe is wrong with the exercise?

Please post some detailed information.

# mentor edit: code removed

mine: ft.shape, c_prev.shape, it.shape, cct.shape (5, 10) (5, 10) (5, 10) (5, 10)
mine: $$$$$$$$$$$$ c_next.shape (5, 5)
ft.shape, c_prev.shape, it.shape, cct.shape (7, 8) (7, 8) (7, 8) (7, 8)
$$$$$$$$$$$$ c_next.shape (7, 7)


AssertionError: Wrong shape for cache1. (7, 7) != (7, 8)


Could you help me to identify the issue?
Thanks!
Best,
Rishat

In the future, please don’t post your code on the forum. That’s not allowed by the Code of Conduct. If a mentor needs to see your code, we’ll contact you privately with instructions.

Hints:

  • Remove the print() statements you have added. Their outputs will clog up the grader.
  • In the concat calculation, the “axis=0” is not necessary.
  • The c_next and a_next calculations should not use np.dot(). Use the * operator instead. Do not use any transpositions there.
  • In the yt_pred calculation, don’t use a transposition.
1 Like

Tom has answered everything, but it looks like you misinterpreted several of the math formulas. For future reference, it’s important to understand the notational convention that Prof Ng uses for matrix multiplication: if he just write the operands adjacent to each other with no explicit operator, then it is “real” matrix multiply (meaning dot product style with np.dot). When he means elementwise multiply, he consistently uses * as the operator. In that case you use np.multiply or * to express that in python/numpy.

Please go back and look at the way the formulas for c_next and a_next are specified in the instructions with what I just described in mind.

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

oops, You are right! Thank you both!

1 Like