DLS course 5 week1 Help! Second lab:Dinosaur Island-Character-Level Language Modeling. The content of the error report does not match the actual situation.

a^{\langle t+1 \rangle} = \tanh(W_{ax} x^{\langle t+1 \rangle } + W_{aa} a^{\langle t \rangle } + b)

First, you have to use the dot product between W_{ax} and x^{\langle t+1\rangle}, and dot product between W_{aa} and a^{\langle t\rangle}. Then you have to add b with them and then take the Tanh.

Hi, thanks for your reply. Here is my code: np.tanh(np.dot(Wax, x) + np.dot(Waa, a_prev) + b). This is exactly what I was doing. I got β 49 a = np.tanh(np.dot(Wax, x) + np.dot(Waa, a_prev) + b),ValueError: shapes (100,27) and (100,27) not aligned: 27 (dim 1) != 100 (dim 0). I got error. It is strange.

But your print statement is after the line that βthrowsβ, so it wonβt get executed, right? Or if thereβs another copy someplace else, then try moving it exactly to be the line before the line that throws so that we can see what weβre really working with here.

Obviously the print statement you show does not match what actually is happening in the line that throws. So the next step as a scientist is to figure out why the two do not match. That is to say: something is flawed about the scientific experiment that you ran, since it produces inconsistent results. So your next debugging step is to figure out why that happened.

Thank you very much. I have solved the problem. The error happened in the second loop because at the end of the first loop, where a new βxβ need to be updated, I updated the variableβs shape as (n_a, vocab_size), but it supposed to be x = np.zeros(((vocab_size, by.shape[1]))), which should match (sequence_lenth, features) convention.