Week 2 - Emojify - Exercise 5 - Emojify_V2

Hi, I’m having a bit of a problem with the last exercise in the Emojify assignment. The error that I’m getting is:

Test failed
Expected value
[‘LSTM’, (None, 128), 131584, (None, 4, 128), ‘tanh’, False]
does not match the input value:
[‘LSTM’, [(None, 128), (None, 128), (None, 128)], 131584, (None, 4, 128), ‘tanh’, False]

So I guess I might be doing something wrong after the first LSTM or? I don’t see where I am inputting the incorrect values. For the LSTM calls I’m using dim of hidden state and then sequence in first and state in second and of course passing embeddings and then X. For pretrained_embedding_layer I am passing word_to_vec_map and word_to_index. And for the rest I am just passing the number given and then X. Anybody have this same problem or know why this might happen?

1 Like

I guess you mix up the assignment and Week 1 Jazz Improvisation with LSTM, they are different:

In Jazz exercise, we constructed the model one-time-step by one-time-step, because the input of time t+1 is the output of time t, we’ve to go for a loop and pass output as well as hidden states of current time step to next time step. However, in the Emojify assignment, we put all time steps inputs together, no loop is necessary, tensorflow will do it for us. So, you needn’t assign initial hidden state to LSTM, unless your model is connected to another one like seq-to-seq model, which is not the case.


Ahh yeah thanks! Changing the call for the second LSTM worked for me. I had thought that the error was in the first one but was wrong. I just had to remove the return_state = True.