C5 W1 A3: Jazz Improvisation with LSTM (Problem and Tips)

For djmodel(). check these common issues:

  • slicing X correctly.
  • using the “reshaper()” and “densor()” functions with the appropriate arguments.
  • used LSTM_cell() with the appropriate “inputs=” and “initial_state=[… ]” arguments.

For music_inference_model(), the common errors are:

  • Instruction 2.D tells you for argmax, use the arguments ‘out’ and ‘axis=-1’, and it says for onehot to use the arguments ‘x’ and ‘depth=n_values’.
  • Instruction 2.E gives you the exact code to use for RepeatVector.

For the inference_model = Model(…):

  • Step 3 says to use the initial values that were created earlier in the function. Those arguments go inside the square brackets. And use “outputs=outputs”.

For predict_and_sample()

  • In Step 2, use “axis=-1”.
  • In Step 3, use n_values for the number of classes.


After all that, if you still get an error about a layer having “multiple inbound nodes”, then try…

  1. save your notebook.
  2. go to the “Kernel” menu in the Notebook, and reset the kernel.
  3. then from the “Cell” menu, re-run all of the cells.

This often seems to clear errors that you’ve fixed but the kernel hasn’t noticed.