Week 1 Assignment 3 Exercise 1

I’m not sure what this error message means but I am stuck on Step 2.C in exercise 1. I am trying to set

a, _, c = LSTM_cell(input = x, initial_state = [a,c])

which is giving me the error message: “as_list() is not defined on an unknown TensorShape.” and I have no idea what that means. I tried writing a, _, c = LSTM_cell but that gave me the error message: “cannot unpack non-iterable LSTM object”

Hi @jmilch ,

it should be ‘inputs’, not ‘input’ when calling LSTM_cell.

Please see the implementation notes below:

2C. Run x through one step of LSTM_cell .

  • Initialize the LSTM_cell with the previous step’s hidden state 𝑎a and cell state 𝑐c.
  • Use the following formatting:
next_hidden_state, _, next_cell_state = LSTM_cell(inputs=input_x, initial_state=[previous_hidden_state, previous_cell_state])
  • Choose appropriate variables for inputs, hidden state and cell state.
1 Like

Ok I have changed it but now I’m getting an error with regards to my densor layer. I currently have

out = densor(a)

because the code comment says to “Apply densor to the hidden state output of LSTM_Cell”. I am getting the error message

“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]”

I would assume this means I made a mistake somewhere before the densor line of code, but I’m not sure

I re ran all of the above cells and now it worked. Thanks for your help Kic!

Hi @jmilch ,

Great to hear you have got it working. Thanks