# DecoderLayer error in test

**URL:** <https://community.deeplearning.ai/t/decoderlayer-error-in-test/129020>\
**Category:** Sequence Models\
**Tags:** coursera-platform\
**Created:** [May 18, 2022, 8:51am UTC](https://community.deeplearning.ai/t/decoderlayer-error-in-test/129020 "2022-05-18T08:51:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lyn\_Rodnel\_Boussengu](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@Lyn\_Rodnel\_Boussengu](https://community.deeplearning.ai/u/Lyn_Rodnel_Boussengu)\
**Post date:** [May 18, 2022, 8:51am UTC](https://community.deeplearning.ai/t/decoderlayer-error-in-test/129020/1 "2022-05-18T08:51:50Z")

</div>

Hello guys,

Can’t figure out what I did wrong when calling self.mha2. Could you please assist?

I call it with the set of arguments self.mha2(Q1, enc\_output, enc\_output, padding\_mask, return\_attention\_scores=True) and i got an error message : AssertionError: Wrong values in attn\_w\_b2. Check the call to self.mha2

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [May 18, 2022, 9:42am UTC](https://community.deeplearning.ai/t/decoderlayer-error-in-test/129020/2 "2022-05-18T09:42:21Z")

</div>

You seem to have missed `training=training` parameter when calling `self.mha2`. This should be present when calling `self.mha1` as well. If that doesn’t fix the error, please click my name and send your notebook as an attachment.

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [May 18, 2022, 1:28pm UTC](https://community.deeplearning.ai/t/decoderlayer-error-in-test/129020/3 "2022-05-18T13:28:17Z")

</div>

@Lyn_Rodnel_Boussengu

Here’s a hint:  
Please look at the figure provided in the writeup for exercise 5.

 ![decoder_layer](https://global.discourse-cdn.com/dlai/original/3X/a/9/a95928d2e0edf0ea502bedb7608ba4ca9a5b5074.png)

The 2nd `Add & Norm` layer takes as inputs the multi-head attention output `multi_attn_out2` and one more term that’s not `multi_attn_out1`.  
`multi_attn_out1` is the output of the 1st multi-head attention layer.

---

<div class="post-metadata">

**Author:** ![Lyn\_Rodnel\_Boussengu](https://avatars.discourse-cdn.com/v4/letter/l/e0b2c6/32.png) [@Lyn\_Rodnel\_Boussengu](https://community.deeplearning.ai/u/Lyn_Rodnel_Boussengu)\
**Post date:** [May 18, 2022, 1:53pm UTC](https://community.deeplearning.ai/t/decoderlayer-error-in-test/129020/4 "2022-05-18T13:53:49Z")

</div>

> [@balaji.ambresh](#):
>
> Add & Norm

It’s working now !! thanks a lot
