Improvise_a_Jazz_Solo_with_an_LSTM_Network_v4

Hey I am facing the following issue-


here is my code–

Step 2: Loop over tx

for t in range(Tx):
    
    # Step 2.A: select the "t"th time step vector from X. 
    x = Lambda(lambda x:X[:,t,:])(X)
    # Step 2.B: Use reshaper to reshape x to be (1, n_values) (≈1 line)
    x = reshaper(x)
    # Step 2.C: Perform one step of the LSTM_cell
    a, _, c = LSTM_cell(x, initial_state= [a, c])
    # Step 2.D: Apply densor to the hidden state output of LSTM_Cell
    out = densor(a)
    # Step 2.E: add the output to "outputs"
    outputs.append(out)
    
# Step 3: Create model instance
model = Model(inputs=[X, a0, c0], outputs=outputs)

### END CODE HERE ###

can anyone please help me??

Do not use “Lambda” for this exercise.
Just use simple matrix slicing.

Also, please edit your message and remove the code. That will keep you clear of the course Honor Code.

1 Like

Could you help to to perform this matrix slicing?

@pedrodpj
Instead of that, use this: x = X[:,t,:]

1 Like

ok, please let me know how to edit this post because I did not find any option here.

@UTKARSH2310 Use the “pencil” tool in your original message, that’s how you edit a message.

Sir I cannot see any pencil tool in the original post, I have the pencil tool in the comment but not in the original post!
I tried to delete the post as well so that it does not cause violations of Honor Code but I am not able to delete it as well!

In the bottom footer of every message you post, you should see a little toolbar that includes a pencil icon.
If you cannot find it, do not worry. I’ll ask a site administrator to delete it.