Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Lingjun Liu committed Sep 13, 2019
1 parent e2662c2 commit e0e81f0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tensorlayer/models/transformer/attention_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class MultiHeadAttentionLayer(tl.layers.Layer):
"""The :class:`MultiHeadAttentionLayer` layer is for multi-head attention computation.
The weight computation is between "key" and "query", which will then matmul with "value" to generate information
that selectively focuses on the "query" messages.
Parameters
-----------
num_heads : int
Expand Down Expand Up @@ -79,7 +80,9 @@ def split_heads(self, x):
The tensor is transposed to insure the inner dimensions hold the correct
values during the matrix multiplication.
Args:
Parameters
-----------
x: A tensor with shape [batch_size, length, hidden_size]
Returns:
Expand All @@ -106,7 +109,7 @@ def combine_heads(self, x):
x: A tensor [batch_size, num_heads, length, hidden_size/num_heads]
Returns:
-----------
-----------
A tensor with shape [batch_size, length, hidden_size]
"""
with tf.name_scope("combine_heads"):
Expand Down

0 comments on commit e0e81f0

Please sign in to comment.