# Wrong values EncoderLayer

**URL:** <https://dlai.staged-by-discourse.com/t/wrong-values-encoderlayer/14702>\
**Category:** Sequence Models\
**Tags:** coursera-platform\
**Created:** [June 17, 2021, 11:51am UTC](https://dlai.staged-by-discourse.com/t/wrong-values-encoderlayer/14702 "2021-06-17T11:51:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SM1](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@SM1](https://dlai.staged-by-discourse.com/u/SM1)\
**Post date:** [June 17, 2021, 11:51am UTC](https://dlai.staged-by-discourse.com/t/wrong-values-encoderlayer/14702/1 "2021-06-17T11:51:29Z")

</div>

Hi,  
Why getting wrong values in EncoderLayer?  
how many arguments should we give to self.mha?  
should mask be modified or directly be given as an argument to self.mha?  
how about x?should it be modified or sliced?

thanks

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlaistaging/user_avatar/dlai.staged-by-discourse.com/tmosh/32/9321_2.png) [@TMosh](https://dlai.staged-by-discourse.com/u/TMosh)\
**Post date:** [June 19, 2021, 3:29am UTC](https://dlai.staged-by-discourse.com/t/wrong-values-encoderlayer/14702/2 "2021-06-19T03:29:49Z")

</div>

(x,x,x,mask) are the parameters.

---

<div class="post-metadata">

**Author:** ![VeElena](https://avatars.discourse-cdn.com/v4/letter/v/e9a140/32.png) [@VeElena](https://dlai.staged-by-discourse.com/u/VeElena)\
**Post date:** [July 14, 2021, 9:01am UTC](https://dlai.staged-by-discourse.com/t/wrong-values-encoderlayer/14702/3 "2021-07-14T09:01:24Z")

</div>

Hi, I ve got stuck with wrong encoder layer values in test: not sure, if I am getting the syntax of tensorflow right, even when following the instructions:  
i.e. 2. Next, you will pass the output of the multi-head attention layer to a dropout layer. Don’t forget to use the `training` parameter to set the mode of your model. → like this: self.dropout1(self\_attn\_output, training)?  
or 3. Now add a skip connection by adding your original input `x` and the output of the dropout layer. → self.layernorm1(self\_attn\_output+x)?

---

<div class="post-metadata">

**Author:** ![jcardona](https://sea1.discourse-cdn.com/dlaistaging/user_avatar/dlai.staged-by-discourse.com/jcardona/32/3601_2.png) [@jcardona](https://dlai.staged-by-discourse.com/u/jcardona)\
**Post date:** [July 15, 2021, 9:43pm UTC](https://dlai.staged-by-discourse.com/t/wrong-values-encoderlayer/14702/4 "2021-07-15T21:43:49Z")

</div>

Hi. Did you remember to use the mask? it must be passed to the MultiHeadAttention layer.
