C5 W3 A1 modelf layers not coming in the right order

I’m working on the modelf function and whenever I test it, it shows that the last input layer and LSTM layers are switched. I’m confused because I haven’t modified any of the starter code and I am just defining the layers as instructed. Is there a way to figure out how this is happening? This is the output of the test:

[[‘InputLayer’, [(None, 30, 37)], 0], [‘InputLayer’, [(None, 64)], 0], [‘Bidirectional’, (None, 30, 64), 17920], [‘RepeatVector’, (None, 30, 64), 0, 30], [‘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], [‘LSTM’, [(None, 64), (None, 64), (None, 64)], 33024, (None, 1, 64), ‘tanh’], [‘InputLayer’, [(None, 64)], 0], [‘Dense’, (None, 11), 715, ‘softmax’]]
Test failed at index 9
Expected value

[‘InputLayer’, [(None, 64)], 0]

does not match the input value:

[‘LSTM’, [(None, 64), (None, 64), (None, 64)], 33024, (None, 1, 64), ‘tanh’]

AssertionError Traceback (most recent call last)
in
33
34
—> 35 modelf_test(modelf)

in modelf_test(target)
30 assert len(model.outputs) == 10, f"Wrong output shape. Expected 10 != {len(model.outputs)}"
31
—> 32 comparator(summary(model), expected_summary)
33
34

~/work/W3A1/test_utils.py in comparator(learner, instructor)
24 “\n\n does not match the input value: \n\n”,
25 colored(f"{b}", “red”))
—> 26 raise AssertionError(“Error in test”)
27 print(colored(“All tests passed!”, “green”))
28

AssertionError: Error in test

1 Like

It would be worthwhile to check the ordering of inputs at Step 3…

Step 3: Create model instance taking three inputs and returning the list of outputs. (≈ 1 line)
model = Model(inputs=

1 Like

This is what I have for the inputs and outputs:

Model(inputs=[X, s0, c0], outputs=outputs)

1 Like

That looks correct.

But when I submitted my notebook, it’s saying that the model summary is different than what is expected.

Then you have some other error.

Is it possible to make a private post with my code?

I reviewed the code, there was an error in Step 2.B.

1 Like

hi, i have the same problem, would you please help me to look at my code? thanks

I will send you a DM (Direct Message) about how to proceed with that.