# C5W4 EncoderTest Error

**URL:** <https://community.deeplearning.ai/t/c5w4-encodertest-error/152176>\
**Category:** Sequence Models\
**Tags:** coursera-platform\
**Created:** [July 1, 2022, 7:46pm UTC](https://community.deeplearning.ai/t/c5w4-encodertest-error/152176 "2022-07-01T19:46:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carlos\_Poles](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@Carlos\_Poles](https://community.deeplearning.ai/u/Carlos_Poles)\
**Post date:** [July 1, 2022, 7:46pm UTC](https://community.deeplearning.ai/t/c5w4-encodertest-error/152176/1 "2022-07-01T19:46:50Z")

</div>

Hi guys

I’ve been getting the following error:

* * *

AssertionError Traceback (most recent call last)  
 in   
1 # UNIT TEST  
----\> 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”  
145  
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.

---

<div class="post-metadata">

**Author:** ![Carlos\_Poles](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@Carlos\_Poles](https://community.deeplearning.ai/u/Carlos_Poles)\
**Post date:** [July 1, 2022, 10:06pm UTC](https://community.deeplearning.ai/t/c5w4-encodertest-error/152176/2 "2022-07-01T22:06:44Z")

</div>

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.
