Skip to content

Commit d93f2a5

Browse files
author
shixiaowen03
committed
attention is all u need
1 parent fdc8cdd commit d93f2a5

File tree

3 files changed

+45
-43
lines changed

3 files changed

+45
-43
lines changed

.idea/workspace.xml

Lines changed: 41 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

basic/Basic-Transformer-Demo/data_load.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def get_batch_data():
8181

8282
num_batch = len(X) // hp.batch_size
8383

84-
print(X[:10],Y[:10])
84+
print(X[:10])
85+
print(Y[:10])
8586
X = tf.convert_to_tensor(X,tf.int32)
8687
Y = tf.convert_to_tensor(Y,tf.int32)
8788

basic/Basic-Transformer-Demo/modules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ def multihead_attention(queries,keys,num_units=None,
157157

158158
# Linear projection
159159
Q = tf.layers.dense(queries,num_units,activation=tf.nn.relu) #
160-
K = tf.layers.dense(queries,num_units,activation=tf.nn.relu) #
161-
V = tf.layers.dense(queries,num_units,activation=tf.nn.relu) #
160+
K = tf.layers.dense(keys,num_units,activation=tf.nn.relu) #
161+
V = tf.layers.dense(keys,num_units,activation=tf.nn.relu) #
162162

163163
# Split and Concat
164164
Q_ = tf.concat(tf.split(Q,num_heads,axis=2),axis=0) #

0 commit comments

Comments
 (0)