Error in Jazz Improvisation with LSTM

I followed the instruction for each step. When I tried the model comparison, I got the error:
AssertionError Traceback (most recent call last)
4 # print("%%%%")
5 # print(djmodel_out)
----> 6 comparator(output, djmodel_out)

~/work/W1A3/ in comparator(learner, instructor)
16 def comparator(learner, instructor):
17 if len(learner) != len(instructor):
—> 18 raise AssertionError(“Error in test. The lists contain a different number of elements”)
19 for index, a in enumerate(instructor):
20 b = learner[index]

AssertionError: Error in test. The lists contain a different number of elements

And when I print out the model summary, I found my model has 8190 params while the expected params are 45530. I am not sure which part went wrong?

It seems out = densor(x) is not right based on the instruction. But a and c do not have correct dims.

The output of the LSTM_cell() is ‘a’, not ‘x’.

Yes, I initially used
a, _, c = LSTM_cell(inputs=x, initial_state=[a,c])
out = densor(a), but got error like below:
ValueError: Input 0 of layer dense is incompatible with the layer: expected axis -1 of input shape to have value 90 but received input with shape [None, 64], not sure what is wrong here…

I found someone had the same issue, which got resolved by restarting the kernel. I did the same thing and it works.

That means that you had changed the code to be correct, but had not actually executed the cell that was changed. Just typing new code in a function and then calling the function again runs the old code. You have to actually click “Shift-Enter” on the cell you changed in order for the new code to get interpreted and included in the runtime image. Restarting the kernel and running all cells is an easy way to get things to be consistent again.

What You See is not necessarily What You Get. You can easily demonstrate to yourself how this works.