Error in :Jazz improvisation with LSTM

I am getting the following error

AttributeError: The layer "reshape_121" has multiple inbound nodes, with different output shapes. Hence the notion of "output shape" is ill-defined for the layer. Use `get_output_shape_at(node_index)` instead.

{moderator edit - solution code removed}

IDK whats happening, please help

Taking the course on courser

You can find lots of threads about this error by searching for “multiple inbound nodes”. Here’s another recent thread that gives some links.

The first thing to try is to make sure your notebook is in a consistent state:

Kernel -> Restart and Clear Output
Cell -> Run All

Then check if the error still occurs.

Also note that we’re not supposed to share solution code in a public way. If the mentors can’t figure out how to help without seeing your code, there are private ways to accomplish that. No harm is done, since I just edited your post to remove the source code.

Hi Paul,

Thank you, it worked. Im sorry about posting the full solution. Will keep that in mind from now. Thanks again!!!

That’s good news! If the “Kernel → Restart” trick works, that means that you had run some of the cells multiple times or in the wrong order. In a lot of the assignments in DLS C5, there are “stateful” global objects that get created (e.g. LSTM_cell in this instance) and executing some of the cells changes the state of the global objects. So it doesn’t always work if you run the test cell multiple times without running everything from scratch. Here’s a recent reply from Tom about a similar situation that explains this in more detail.

oh okay. Before coming here, I actually ran the cells from the beginning in order. It did not work :frowning:

I checked the link u sent, thanks again. Will keep this in mind, maybe will be handy for the NLP specialisation as well

Be sure you restart the kernel first.