C5W3A1 The Size of the Input Layer not Matched

Hello everyone, in the Neural Machine Translation assignment of W3, I met a problem that says the shape of the input layer that I defined is wrong.

I didn’t modify the definition of the inputs, and I downloaded the latest notebook to double check that.

# Define the inputs of your model with a shape (Tx,)
# Define s0 (initial hidden state) and c0 (initial cell state)
# for the decoder LSTM with shape (n_s,)
X = Input(shape=(Tx, human_vocab_size))
s0 = Input(shape=(n_s,), name='s0')
c0 = Input(shape=(n_s,), name='c0')
s = s0
c = c0

In defining the model, I put the three inputs in the list, simply Model(input=[X, s0, c0]...), but error was raised.

[['InputLayer', [(None, 64)], 0], ['InputLayer', [(None, 30, 37)], 0], ['RepeatVector', (None, 30, 64), 0, 30], ['Bidirectional', (None, 30, 64), 17920], ['Concatenate', (None, 30, 128), 0], ['Dense', (None, 30, 10), 1290, 'tanh'], ['Dense', (None, 30, 1), 11, 'relu'], ['Activation', (None, 30, 1), 0], ['Dot', (None, 1, 64), 0], ['InputLayer', [(None, 64)], 0], ['LSTM', [(None, 64), (None, 64), (None, 64)], 33024, [(None, 1, 64), (None, 64), (None, 64)], 'tanh'], ['Dense', (None, 11), 715, 'softmax']]
Test failed at layer: 0 
 Expected value 

 ['InputLayer', [(None, 30, 37)], 0] 

 does not match the input value: 

 ['InputLayer', [(None, 64)], 0]

Interestingly, I can still proceed in the following cells, though the prediction made by the model is quite a mess.

The size of X is indeed (None, 30, 37), and that of s0 and c0 is (None, 64), and I did put X before s0 and c0, but why in the model summary (None, 64) came before (None, 30, 37)?


Hey friends! Luckily, I made it to find the bug, it occurs way before this unit. It was in # UNQ_C1, in concatenating, it is required to # For grading purposes, please list 'a' first and 's_prev' second, in this order., but I didn’t follow it, which is the cause of the following bug. However, I still passed that test.

I suggest that we should have an extra test in this unit to verify the order of s_prev and a, so that students can find their bugs before just went on.

1 Like

Thanks for your report.
I’ll submit an issue to add a test for this condition.