Emojify v2 :AttributeError: 'InputLayer' object has no attribute 'output_shape'

Hello.
I am trying to solve ex5. After following the instruction for Emojify_V2, and perform:
model = Emojify_V2((maxLen,), word_to_vec_map, word_to_index)

summary(model)
I get:AttributeError: ‘InputLayer’ object has no attribute ‘output_shape’
my model.summary() printout is:
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Layer (type) ┃ Output Shape ┃ Param # ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ input_layer_21 (InputLayer) │ (None, 4) │ 0 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ embedding_44 (Embedding) │ (None, 4, 50) │ 20,000,050 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ lstm_42 (LSTM) │ (None, 4, 128) │ 91,648 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dropout_42 (Dropout) │ (None, 4, 128) │ 0 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ lstm_43 (LSTM) │ (None, 128) │ 131,584 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ dropout_43 (Dropout) │ (None, 128) │ 0 │
├─────────────────────────────────┼────────────────────────┼───────────────┤
│ activation_21 (Activation) │ (None, 128) │ 0 │
└─────────────────────────────────┴────────────────────────┴───────────────┘
Any idea?

1 Like

Please click my name and message your notebook as an attachment.

1 Like

Hi. Any idea?

בתאריך יום א׳, 14 באפר׳ 2024, 19:11, מאת Balaji Ambresh via DeepLearning.AI ‏<notifications@dlai.discoursemail.com>:

Please note that call to summary(model) inspects the output_shape property of a layer. This is not what you want. Look at the comparator function. It compares the layers as is.

Do note that changing the provided starter code at places not expected to change is likely to go produce wrong results. You’ve removed the test code and replaced it with a custom code snippet.

All of the above said, there’s a problem with your model since you’ve removed this comment:
# Propagate X through a Dense layer with 5 units

Use this link to get a fresh copy of the notebook if required.

1 Like

OK. Got it. Thx.