Course 5 Assignment 3 djmodel

I am getting this error. I’ve seen that many other students have encountered this issue, but I am still not sure how to solve this. Help will be much appreciated.

You are inputting the previous layer’s output, correct? Note that, from other thread on this matter, x should have this slicing X[:,t,:].

2 Likes

Thank you. I was using x = X[t]. Changing it to x = X[:,t,:] and re-running the previous cells fixed the issue.

Great! Perhaps, you can help with the next problem. When I perform this and get the rest in place for LSTMcell and densor, my model.summary output is

[[‘InputLayer’, [(None, 30, 90)], 0], [‘InputLayer’, [(None, 64)], 0], [‘InputLayer’, [(None, 64)], 0], [‘LSTM’, [(None, 64), (None, 64), (None, 64)], 39680, [(None, 30, 90), (None, 64), (None, 64)], ‘tanh’], [‘Dense’, (None, 90), 5850, ‘softmax’]]

which differs from the djmodel_out the grader has…

djmodel_out = [[‘InputLayer’, [(None, 30, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘Reshape’, (None, 1, 90), 0], [‘InputLayer’, [(None, 64)], 0], [‘InputLayer’, [(None, 64)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘LSTM’, [(None, 64), (None, 64), (None, 64)], 39680, [(None, 1, 90), (None, 64), (None, 64)], ‘tanh’], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘TensorFlowOpLayer’, [(None, 90)], 0], [‘Dense’, (None, 90), 5850, ‘softmax’]]

Do you know what might be causing this? I have restarted the kernel and cleared output a few times.

Thanks.

What are you using for the initial_state of LSTM_cell?

Where are you getting the model summary from the grader?

model summary is in the outputs.py file. It matches what I see in the grader output.

[a,c] not [a0,c0]. But, in the last line for model=Model(…), I use a0 and c0. Does that seem right?

The unit test in the notebook and the test run by the grader are totally different cases.
Do not expect them to give the same results.

1 Like

Yes that’s what I did.

Maybe this will help:

code removed

Yep. That helped. I had put x in for LSTMcell input earlier, but it didn’t work - maybe I hadn’t cleared output and restarted kernel for that change - thought I did. Had been using X; that causeed the problem. Works now. Thanks for everyone’s help here!

can someone explain the code that was deleted? i am having the same issue

Hi there, I have the same issue. But don’t understand from the above what was the solution. Could someone help? P.S I do pass x into LSTMcell (not X).

@Marina_Ankersen, welcome to the community!

This thread has been resolved. And it’s two years old. It also covered several different issues.

I recommend you start a new thread.

Please include the specifics of your issue. It’s good to start with a screen capture image showing any error messages.

1 Like