Created
April 29, 2019 07:59
-
-
Save ChunML/e91d764e5bfd2574352157e3d7b0235c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def call(self, sequence): | |
embed_out = self.embedding(sequence) | |
embed_out += pes[:sequence.shape[1], :] | |
sub_in = embed_out | |
for i in range(self.num_layers): | |
sub_out = self.attention[i](sub_in, sub_in) | |
sub_out = sub_in + sub_out | |
sub_out = self.attention_norm[i](sub_out) | |
ffn_in = sub_out | |
ffn_out = self.dense_2[i](self.dense_1[i](ffn_in)) | |
ffn_out = ffn_in + ffn_out | |
ffn_out = self.ffn_norm[i](ffn_out) | |
sub_in = ffn_out | |
return ffn_out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment