Hi,
I don’t know why but I keep getting this error in the music_inference_model, and it doesn’t go away even after restarting the kernels
AttributeError Traceback (most recent call last)
<ipython-input-32-c395f100af16> in <module>
1 # UNIT TEST
----> 2 inference_summary = summary(inference_model)
3 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 rechecked all the instructions and went through the forums, but none of them seemed to fix the issue. However the inference_model.summary seems to give the correct output even though the unit test is failing. I think I have followed the instructions correctly but the problem still persists. Any more hints?
I was receiving the same error despite my confidence in implementing the correct code. I didn’t consider restarting the kernel could work until I read you tried that. Thankfully, restarting worked for me (this time). Those “errors” that aren’t really errors (sigh) really test my patience (lol). I just don’t understand what’s going on behind scenes as to when/why restarting works, and how I might know when I need to without just trying it.
@NeptuneAnime,
One issue with the exercises is that they use a lot of global variables, so the sequence in which you run the cells is critical. Also, modifying a cell does not automatically re-compile it.
So if you’re jumping around inside the notebook, making a lot of changes to try to fix an error, it is very easy for the notebook to get its global variables into an unexpected state.
Restarting the kernel and re-running all of the cells is the simplest way to explain to students how to fix this.