Skip to content

Commit e0e81f0

Browse files
author
Lingjun Liu
committed
documentation
1 parent e2662c2 commit e0e81f0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tensorlayer/models/transformer/attention_layer.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class MultiHeadAttentionLayer(tl.layers.Layer):
2626
"""The :class:`MultiHeadAttentionLayer` layer is for multi-head attention computation.
2727
The weight computation is between "key" and "query", which will then matmul with "value" to generate information
2828
that selectively focuses on the "query" messages.
29+
2930
Parameters
3031
-----------
3132
num_heads : int
@@ -79,7 +80,9 @@ def split_heads(self, x):
7980
The tensor is transposed to insure the inner dimensions hold the correct
8081
values during the matrix multiplication.
8182
82-
Args:
83+
Parameters
84+
-----------
85+
8386
x: A tensor with shape [batch_size, length, hidden_size]
8487
8588
Returns:
@@ -106,7 +109,7 @@ def combine_heads(self, x):
106109
x: A tensor [batch_size, num_heads, length, hidden_size/num_heads]
107110
108111
Returns:
109-
-----------
112+
-----------
110113
A tensor with shape [batch_size, length, hidden_size]
111114
"""
112115
with tf.name_scope("combine_heads"):

0 commit comments

Comments
 (0)