Week1-Jazz Improvisation with LSTM

Hi,
I’m encountering the following error while using an LSTM model:
“AttributeError: The layer ‘lstm_1’ has multiple inbound nodes, with different input shapes. Hence the notion of ‘input shape’ is ill-defined for the layer. Use get_input_shape_at(node_index) instead.”

The error occurs in this part of my music_inference_model function:
index = tf.math.argmax(out, axis=-1)
x = tf.one_hot(index, depth=n_values)
x = RepeatVector(1)(x)
How can I resolve this issue? I’ve double-checked the code with the RepeatVector and one_hot operations, but I think there might be an issue with how the model shape is defined. How can I properly define the input shape for the LSTM layer?

Thank you in advance for your help.

If you search the forums for “multiple inbound nodes LSTM”, you’ll find lots of hits. E.g. here’s one.

If that’s not enough to get you to a solution, please check your DMs for a message from me about how to proceed.