Skip to content

Instantly share code, notes, and snippets.

@ChunML
Created April 28, 2019 10:19
Show Gist options
  • Save ChunML/1b327a54f0edacc65120056e6852e9b9 to your computer and use it in GitHub Desktop.
Save ChunML/1b327a54f0edacc65120056e6852e9b9 to your computer and use it in GitHub Desktop.
# MIDDLE MULTIHEAD SUB LAYER
mid_sub_in = bot_sub_out
mid_sub_out = []
for j in range(mid_sub_in.shape[1]):
attention = self.attention_mid[i](
tf.expand_dims(mid_sub_in[:, j, :], axis=1), encoder_output)
mid_sub_out.append(attention)
mid_sub_out = tf.concat(mid_sub_out, axis=1)
mid_sub_out = mid_sub_out + mid_sub_in
mid_sub_out = self.attention_mid_norm[i](mid_sub_out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment