Skip to content
This repository was archived by the owner on Jan 1, 2021. It is now read-only.

Commit 6a05182

Browse files
authored
fixed some typo
1 parent 41d2823 commit 6a05182

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

examples/04_word2vec_starter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def word2vec(batch_gen):
3232
# center_words have to be int to work on embedding lookup
3333

3434
# TO DO
35-
tf.name_scope('data'):
35+
with tf.name_scope('data'):
3636
center_words = tf.placeholder(tf.int32, [BATCH_SIZE], name='center_words')
3737
target_words = tf.placeholder(tf.int32, [BATCH_SIZE, 1], name='target_words')
3838

@@ -41,15 +41,15 @@ def word2vec(batch_gen):
4141
# initialized to random uniform -1 to 1
4242

4343
# TOO DO
44-
tf.name_scope('embedding_matrix'):
44+
with tf.name_scope('embedding_matrix'):
4545
embed_matrix = tf.Variable(tf.random_uniform([VOCAB_SIZE, EMBED_SIZE], -1.0, 1.0), name='embed_matrix')
4646

4747
# Step 3: define the inference
4848
# get the embed of input words using tf.nn.embedding_lookup
4949
# embed = tf.nn.embedding_lookup(embed_matrix, center_words, name='embed')
5050

5151
# TO DO
52-
tf.name_scope('loss'):
52+
with tf.name_scope('loss'):
5353
embed = tf.nn.embedding_lookup(embed_matrix, center_words, name='embed')
5454

5555
# Step 4: construct variables for NCE loss
@@ -106,4 +106,4 @@ def main():
106106
word2vec(batch_gen)
107107

108108
if __name__ == '__main__':
109-
main()
109+
main()

0 commit comments

Comments
 (0)