[ Course 5 Week 3] Assignment1: Neural_machine_translation_with_attention_v4a

HI all

I ran into error when I ran test for modelf

The error message is below:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-39-d6a140825d8e> in <module>
     34 
     35 
---> 36 modelf_test(modelf)

<ipython-input-39-d6a140825d8e> in modelf_test(target)
     13     model = target(Tx, Ty, n_a, n_s, len_human_vocab, len_machine_vocab)
     14 
---> 15     print(summary(model))
     16 
     17 

~/work/W3A1/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 "concatenate" 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.

However, When I continued running the code, nothing seemed wrong and when I submitted the assignment, it seemed that my code is right.

Has anyone met the same problem? Or does anyone know why it happened?

Many thanks

3 Likes

Hi XINYAN_ZHANG,

Below modelf there is a troubleshooting note that states the following:

If you are getting repeated errors after an initially incorrect implementation of "model", but believe that you have corrected the error, you may still see error messages when building your model.
A solution is to save and restart your kernel (or shutdown then restart your notebook), and re-run the cells.

Hopefully this will solve your problem.

14 Likes

You saved me! Thank you

2 Likes