C5W4 EncoderTest Error

Hi guys

I’ve been getting the following error:

AssertionError Traceback (most recent call last)
----> 2 Encoder_test(Encoder)

~/work/W4A1/public_tests.py in Encoder_test(target)
142 [[-0.01885331, 0.8866553 , -1.624897 , 0.75709504],
143 [ 0.4165045 , 0.27912217, -1.6719477 , 0.97632086],
→ 144 [ 0.71298015, -0.7565592 , -1.1861688 , 1.2297478 ]]]), “Wrong values case 3”
146 print(“\033[92mAll tests passed”)

AssertionError: Wrong values case 3

I can’t figure out what is wrong. I think it may have something to do with the embedding scaling as mentioned in another post. Someone was using seq_len instead of the embedding dimension, but I did not make that mistake. Tried different ways to make the same computation but it has not worked.

I have used tf.cast and tf.math.sqrt for the embedding scaling

tf.math.sqrt(tf.cast(******, dtype=tf.float32))

Any thoughts on what might be happening?

I’ve been getting the same error with the Decoder.

That’s all I need to finish the Specialization!

Thanks in advance.

I figured out what the error was.

I had hard coded the training argument in the dropout layer function call.

I will leave the post in case someone gets the same error.