Attention assignment, model summary mismatch

I am getting the following error when submitting my Assignment 1 Week 4 for grading:
Please let me know if this is a known issue with the grader, as the code passes the tests without raising any error:

Code Cell UNQ_C1: Function 'one_step_attention' is correct.
cell_UNQ_C2 function modelf summary does not match the expected model 
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.

The issue seems to come from the fact that the model’s layers, as displayed in model.summary() are not in the same order as specified in the modelf function. The grader function is probably assuming that the oder is respected, hence the error in the grader. @DLS_Mentors , please advise on possible solutions, as I am facing strict deadlines. Thank you so much for your help.

The deadlines here are fake, so don’t stress about those.

Funny, I just ended up seeing this same problem in Course 4 Week 2 in the Residual Net exercise. It turns out that model summary gets constructed based on the computational graph, so order can matter in the case that you have “skip” layers followed by an “Add” layer. In that case, since addition is commutative, you’d expect the order of the operands not to matter, but it does in terms of the order of the computation graph. Try looking for that situation in your code and experimenting with the order of operands.

Just for reference, here’s the other thread that discusses this type of issue in C4.

Hey @Sacha_B, please refrain from using words like “issue with grader” in topic headers as they indicate something might be wrong with the grader, when in fact, it is functioning properly. It can give the wrong idea to the other learners as well.
I have removed and renamed your post to “Attention assignment, modelf summary mismatch”.
Thank you.

Thanks for your answers. I am probably doing a silly error since I am the only one reporting this issue, but for some reason, the following code:
input_x = Input(shape=(Tx, human_vocab_size), name = ‘inputs’)
s0 = Input(shape=(n_s,), name=‘s0’)
c0 = Input(shape=(n_s,), name=‘c0’)
s = s0
c = c0

creates the s0 layer before the input_x layer, and inter-changing the order, as proposed by @paulinpaloalto does not change the model’s output:
[[‘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’]]

Of course, I can re-arrange the expected summary as a temporary solution, but since the grader is looking for exactly the right order, the grading eventually fails, hence the use of “issue with grader” @Mubsi .
Thank you for your help.

I must also add that the remaining code runs without error, so I don’t suspect the problem is coming from my implementation, shouldn’t the grader consider the fact that layers are created in the computational graph in (almost) a random order and accept the code in this case @Mubsi ? Thank you

@Sacha_B I got the same error and it turns out that in the implementation of the one_step_attention I looked at the image and typed wrong order of a and s_prev