Week 1 Jazz Solo with LSTM v4 possibly badly implemented unit test

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.

Hi all, same here. I tried restarting the kernel to no avail. This does not seem to affect the end result.

Hey @guillempg , can you DM your notebook ? I’ll take a look. Thanks.

Even I’m getting a test_utils.py related error in the Unit Test of the djmodel function. @Mubsi

Any update on this? I’m also getting the same error.

I got the same error. No idea what’s wrong with my code. But the grader said my code is correct.

I have the same problem. Is this our implemented code problem or the grader problem?

The problem was solved !! thanks.

how? I have the same problem…

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.

Getting the same error, have restarted kernel and cleared output, still no luck. Any update?

2 Likes

The question is … what is incorrect?
It seems that this part is the incorrect one… but what is wrong?

x = tf.math.argmax(out)
x = tf.one_hot(x, n_values)

found it… thanks :slight_smile:
20 characters restriction

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.

1 Like

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

2 Likes

adding previous axis to argmax() will solve this issue…have a great day

1 Like

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.

Thanks to all!

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.

1 Like