diff options
author | A. Unique TensorFlower <nobody@tensorflow.org> | 2016-04-28 17:18:27 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-04-28 18:21:17 -0700 |
commit | c75dfc06f571b46c4b4b677de98d2ecde1e4c311 (patch) | |
tree | ebd972b06ffb47953b0c602a405bd643f0e00c35 /tensorflow/examples/tutorials/word2vec | |
parent | dac77d49dbef14ede5310cce6ba70e2abc6d77fd (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.py | 5 |
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 |