Week1:Assignment3:Improvise_a_Jazz_Solo_with_an_LSTM_Network_v4

After implementation of djmodel:

resulted in error while running “model = djmodel(Tx=30, LSTM_cell=LSTM_cell, densor=densor, reshaper=reshaper)”
saying
ValueError: Layer lstm expects 17 inputs, but it received 3 input tensors. Inputs received: [<tf.Tensor ‘reshape/Reshape_95:0’ shape=(None, 1, 90) dtype=float32>, <tf.Tensor ‘a0_11:0’ shape=(None, 64) dtype=float32>, <tf.Tensor ‘c0_11:0’ shape=(None, 64) dtype=float32>]

@Monica_Saraswathi Dear Monica,

So one of the Mods/Mentors will kindly freak out at you that you are not supposed to post your code here and gently remove it for you. :grin:

However-- Without totally ‘giving it all away’, recall we are updating the LSTM cell hidden state and cell state at every step, not constantly working from only the original state(s).

They also, helpfully, provide you with a pair of ‘stand-in’ variables to kind of poke you in this direction…

1 Like

I had run once again and this time this error is not there,instead
while runnig this cell:
output = summary(model)
comparator(output, djmodel_out)

Test failed at index 2
Expected value

[‘Reshape’, (None, 1, 90), 0]

does not match the input value:

[‘TensorFlowOpLayer’, [(None, 90)], 0]

AssertionError Traceback (most recent call last)
in
3 # UNIT TEST
4 output = summary(model)
----> 5 comparator(output, djmodel_out)

~/work/W1A3/test_utils.py in comparator(learner, instructor)
24 “\n\n does not match the input value: \n\n”,
25 colored(f"{b}", “red”))
—> 26 raise AssertionError(“Error in test”)
27 print(colored(“All tests passed!”, “green”))
28

AssertionError: Error in test
this is the error.Kindly help

Hmmm… so you are having some mistake when you are calling the reshaper() function, which you were not expected to write. I’d look carefully at the line where you call the function again.

You should be getting this:

But you are only getting a plain vanilla ‘TensorFlowOpLayer’ back.

1 Like

Hi,i did a mistake, instead of passing initial states for my model, I have passed a and c . So,was the error :stuck_out_tongue: Thanks for your time!

1 Like

:grin: Oh yes, you do need to pass those when you create the model, but not in the loop. Glad you solved it.

My personal methodology is to try and give hints-- not ‘answers’. The learning is better that way :D.

3 Likes