Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is Layer Normalization in TransformerEncoderLayer2D placed in the correct position? #46

Open
S-aiueo32 opened this issue Nov 14, 2020 · 5 comments

Comments

@S-aiueo32
Copy link

Hello,

I found Layer Normalization is placed after self-attention and the residual connection in TransformerEncoderLayer2D.

attn_out, _ = self.attention(src, src, src, src_mask)
out1 = src + attn_out
out1 = out1.transpose(1, 2).contiguous().view(b, c, h, w)
out1 = self.norm(self.attention_norm, out1)

I think it is a common way of basic transformers, however, the official implementation of SATRN places it before. Do you have any plans to align your code to the original one, or basis for reliability?

@ChaseMonsterAway
Copy link
Contributor

Yes, we implement satrn before the code released. We will update the satrn in the future.

@S-aiueo32
Copy link
Author

Good! I will keep this issue open for future fix about it!

@Johnson-yue
Copy link

this bug is not fixed for now ????

@ChaseMonsterAway
Copy link
Contributor

this bug is not fixed for now ????

We do some other jobs for now, i will fix it as soon as possible.

@Johnson-yue
Copy link

ok,thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants