C5W4A1:EncoderLayer AssertionError: Wrong values when training=True

Hey, I’ve been stuck on the EncoderLayer function from C5W4 for hours now, getting the following error

AssertionError                            Traceback (most recent call last)
<ipython-input-24-00617004b1af> in <module>
      1 # UNIT TEST
----> 2 EncoderLayer_test(EncoderLayer)

~/work/W4A1/public_tests.py in EncoderLayer_test(target)
     92                        [[ 0.23017104, -0.98100424, -0.78707516,  1.5379084 ],
     93                        [-1.2280797 ,  0.76477575, -0.7169283 ,  1.1802323 ],
---> 94                        [ 0.14880152, -0.48318022, -1.1908402 ,  1.5252188 ]]), "Wrong values when training=True"
     95 
     96     encoded = encoder_layer1(q, False, np.array([[1, 1, 0]]))

AssertionError: Wrong values when training=True

Also, as mentioned in this thread, I did not use more than 1 dropout layer either.

Would help me a great deal if anyone could help!

2 Likes

Did you use training=training in the dropout_ffn() layer?

3 Likes

Yes. I found the error. Thank You

Facing the same problem, where do I put training=training?

I do, but still have the same error message :frowning:

1 Like

Perhaps you’re not using the ffn_output layer correctly when you’re calling layernorm2().

3 Likes

Or maybe you’re using training=training somewhere that you shouldn’t.

Hello team, I am facing a similar error here. I used “training=training” as an argument for self.mha()
self.dropout_fnn()

Any clues where I could be getting it wrong? Below is the Assertion Error.


AssertionError Traceback (most recent call last)
in
1 # UNIT TEST
----> 2 EncoderLayer_test(EncoderLayer)

~/work/W4A1/public_tests.py in EncoderLayer_test(target)
92 [[ 0.23017104, -0.98100424, -0.78707516, 1.5379084 ],
93 [-1.2280797 , 0.76477575, -0.7169283 , 1.1802323 ],
—> 94 [ 0.14880152, -0.48318022, -1.1908402 , 1.5252188 ]]), “Wrong values when training=True”
95
96 encoded = encoder_layer1(q, False, np.array([[1, 1, 0]]))

AssertionError: Wrong values when training=True

Training should be probably everywhere, in the last layernorm2 the sum should be of the already normalized multi-head attention output (so output from the layernorm1) and the ffn_output.

1 Like

same issue

Any help?

It’s working for me. thank you!