Problem with music_inference_model LSTM

Please add a tag indicating where you are taking the course. Choose only one of the platform options in the tag section then the week/module

Apologies for the initial dummy post . I am stuck in the music inference model Test . I run it and I get the following output :

Outputs =  50
Single output shape =  (None, 90)
len(pred) =  50
pred[0].shape =  (1, 90)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-46-8f5b8c69817f> in <module>
     36 assert pred[0].shape == expected_pred_shape, f"Expected prediction shape {expected_pred_shape}, but got {pred[0].shape}"
     37 
---> 38 inference_summary = summary(inference_model)
     39 comparator(inference_summary, music_inference_model_out)

~/work/W1A3/test_utils.py in summary(model)
     36     result = []
     37     for layer in model.layers:
---> 38         descriptors = [layer.__class__.__name__, layer.output_shape, layer.count_params()]
     39         if (type(layer) == Conv2D):
     40             descriptors.append(layer.padding)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in output_shape(self)
   2190                            'ill-defined for the layer. '
   2191                            'Use `get_output_shape_at(node_index)` '
-> 2192                            'instead.' % self.name)
   2193 
   2194   @property

AttributeError: The layer "lstm_1" 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.

I checked the shapes of x,a,c at every iteration , and they seem to be ok . Can somebody help ?

That “multiple inbound nodes” error has happened to quite a few people. You can find lots of posts about it by doing a forum search. E.g. please have a look at this one or this one and let us know if that sheds any light.

Thanks . Turns out that I did find a similar post . The fix is to just rerun all the cells prior to the one in question .

2 Likes

This is particularly important in DLS Course 5 (Sequence Models), because the notebooks use a lot of global objects which are easily mangled during debugging.

Yes . You should probably add it to the instructions to the lab . I spent a lot of time debugging through the matrices .