The unit test of the function music_inference_model(LSTM_cell, densor, Ty=100) fails with an error that hints that the test_utils.py might not be correctly implemented to test LSTM:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-19-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" 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.
If your code is actually correct but you still get this error, you need to restart your notebook’s kernel and run it again. That’s how I solved mine. If that doesn’t work then oh well your code wasn’t correct.
For those wondering. Despite the error, and numbers not matching down the line, I’ve submitted the assignment anyway and it seems like I have passed.
It could be an issue on the tests only. Once you complete the assignment and are confident that the code is correct, submit it anyway.
I hope the moderators will take a look at this assignment soon enought.
Not working for me, after I submitted, it just said “can not compile with that error” and get 0 points even though I have passed the first test in exercise 2…
(updated) problem solved after adding the axis in argmax, but it still need a restart for the kernal
I’ll answer myself here for anyone interested…
I fixed a bug in my implementation (was not properly selecting the “next” value, the argument to tf.argmax needs to have the proper axis specified) and even though it didn’t remove that error that I posted above, it passed the grader (which previously didn’t), therefore this error, as mentioned in some replies below, is not blocking the submission.
I was also facing this same error. I got clue from this thread where people mentioned about adding axis to tf.arg.max. I was already having axis in my implementation. When I toggled its value, error in my code got fixed. If anyone is stuck at this point and already having axis in the code, try to toggle it. Due to honor’s code I may not reveal what exactly I used for axis parameter. But I hope this hint would be helpful to other prople.