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

layer norm end of the encoder? #33

Open
salihgunduz opened this issue Feb 25, 2020 · 0 comments
Open

layer norm end of the encoder? #33

salihgunduz opened this issue Feb 25, 2020 · 0 comments

Comments

@salihgunduz
Copy link

should a layer norm be at the end of encoder layer like below? if I search orginal paper there is norm layer after pos-ffn.
class EncoderLayer():
def init(self, d_model, d_inner_hid, n_head, dropout=0.1):
self.self_att_layer = MultiHeadAttention(n_head, d_model, dropout=dropout)
self.pos_ffn_layer = PositionwiseFeedForward(d_model, d_inner_hid, dropout=dropout)
self.norm_layer = LayerNormalization()
def call(self, enc_input, mask=None):
output, slf_attn = self.self_att_layer(enc_input, enc_input, enc_input, mask=mask)
output1 = self.norm_layer(Add()([enc_input, output]))
output = self.pos_ffn_layer(output1)
output = self.norm_layer(Add()([output1 , output]))
return output, slf_attn

encoder

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

1 participant