aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/examples/tutorials/word2vec
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2016-04-28 17:18:27 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-04-28 18:21:17 -0700
commitc75dfc06f571b46c4b4b677de98d2ecde1e4c311 (patch)
treeebd972b06ffb47953b0c602a405bd643f0e00c35 /tensorflow/examples/tutorials/word2vec
parentdac77d49dbef14ede5310cce6ba70e2abc6d77fd (diff)
Brings tutorial code in line with best practice re keeping graph construction and graph execution separate.
Change: 121078652
Diffstat (limited to 'tensorflow/examples/tutorials/word2vec')
-rw-r--r--tensorflow/examples/tutorials/word2vec/word2vec_basic.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/examples/tutorials/word2vec/word2vec_basic.py b/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
index 83bb5dd165..9f3a03e352 100644
--- a/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
+++ b/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
@@ -171,12 +171,15 @@ with graph.as_default():
similarity = tf.matmul(
valid_embeddings, normalized_embeddings, transpose_b=True)
+ # Add variable initializer.
+ init = tf.initialize_all_variables()
+
# Step 5: Begin training.
num_steps = 100001
with tf.Session(graph=graph) as session:
# We must initialize all variables before we use them.
- tf.initialize_all_variables().run()
+ init.run()
print("Initialized")
average_loss = 0