Week1, Assignment 3 - music_inference_model - inputs tensor incorrect

Hi,

the inputs I am giving to my lstm_cell are not as expected.
I have the following error :

ValueError: Layer lstm expects **5** inputs, but it received 3 input tensors.

I have check the shapes of my inputs and they are as follow :

x shape is  (None, 1, 90)
a shape is  (None, 64)
c shape is  (None, 64)

finally, I noticed that each time I rerun the cell, the in between stars above increases.

I have read a few post about this and didn’t find a solution. How did you pass this one ?

Edouard

You only need to use two arguments :

  • The correct variable for the “input_state”
  • Substitute the correct variables for the hidden state and the cell state, inside the square brackets for the “input_shape = […]”.

Hello TMosh,

That is exactly what I have done :

# Step 2.A: Perform one step of LSTM_cell. Use "x", not "x0" (≈1 line)
a, _, c = LSTM_cell(x, initial_state=[a, c])

I don’t even understand the hint Use “x”, not “x0” in the comment, as we need to give x as input, even though for the first loop t=0, it will be x0.

When I run the cell for the first time I got those results/shapes :

t =  0
x shape is  (None, 1, 90)
a shape is  (None, 64)
c shape is  (None, 64)
x shape after lstm is  (None, 1, 90)
a shape after lstm is  (None, 64)
c shape after lstm is  (None, 64)
out shape is  (None, 90)
x shape after argmax is  (None,)
x shape after one_hot is  (None, 64)
x shape after repeatvector is  (None, 1, 64)
t =  1
x shape is  (None, 1, 64)
a shape is  (None, 64)
c shape is  (None, 64)

It doesn’t go further and give me the error :
ValueError: Input 0 is incompatible with layer lstm: expected shape=(None, None, 90), found shape=[None, 1, 64]

Maybe the problem is with the shape of ‘x’.

I am sorry for my previous question… it is not n_a which equals 90. I have corrected it, and x has the expected shape (None, 1, 90) as requested on each loop.

So many hours because I was not able to read correctly.

Thank you for your help.

Hey, what did you change? I am still not able to figure out what is wrong here.