# Transformer's Encoder with Self-Attention layers

**URL:** <https://community.konduit.ai/t/transformers-encoder-with-self-attention-layers/1016>\
**Category:** SameDiff\
**Created:** [November 29, 2020, 12:50pm UTC](https://community.konduit.ai/t/transformers-encoder-with-self-attention-layers/1016 "2020-11-29T12:50:15Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [December 14, 2020, 7:46pm UTC](https://community.konduit.ai/t/transformers-encoder-with-self-attention-layers/1016/22 "2020-12-14T19:46:26Z")

</div>

I’ve answered the question on when and how to apply a mask in SameDiff over at your other thread: [Feature Mask application in custom SameDiff model - #2 by treo](https://community.konduit.ai/t/feature-mask-application-in-custom-samediff-model/1058/2)

> [@partarstu](#):
>
> But BP is my problem. I haven’t found any available solution to force the BP in `SameDiff` into using the feature masks. Do you have any suggestions how I could workaround this issue?

It isn’t necessary for you to do that. They will be automatically applied during backprop with SameDiff when you apply it in the forward pass. The entire point of SameDiff is that it does the entire backprop for you so you don’t have to define it manually.

---

_[View the full topic](https://community.konduit.ai/t/transformers-encoder-with-self-attention-layers/1016)._
