aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/examples/tutorials
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/examples/tutorials')
-rw-r--r--tensorflow/examples/tutorials/mnist/fully_connected_feed.py4
-rw-r--r--tensorflow/examples/tutorials/mnist/mnist_softmax.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/examples/tutorials/mnist/fully_connected_feed.py b/tensorflow/examples/tutorials/mnist/fully_connected_feed.py
index fbf4000e8f..be50f4529f 100644
--- a/tensorflow/examples/tutorials/mnist/fully_connected_feed.py
+++ b/tensorflow/examples/tutorials/mnist/fully_connected_feed.py
@@ -108,7 +108,7 @@ def do_eval(sess,
images_placeholder,
labels_placeholder)
true_count += sess.run(eval_correct, feed_dict=feed_dict)
- precision = true_count / num_examples
+ precision = float(true_count) / num_examples
print(' Num examples: %d Num correct: %d Precision @ 1: %0.04f' %
(num_examples, true_count, precision))
@@ -146,7 +146,7 @@ def run_training():
init = tf.global_variables_initializer()
# Create a saver for writing training checkpoints.
- saver = tf.train.Saver(write_version=tf.train.SaverDef.V2)
+ saver = tf.train.Saver()
# Create a session for running Ops on the Graph.
sess = tf.Session()
diff --git a/tensorflow/examples/tutorials/mnist/mnist_softmax.py b/tensorflow/examples/tutorials/mnist/mnist_softmax.py
index 9d00c0f9af..42a406d386 100644
--- a/tensorflow/examples/tutorials/mnist/mnist_softmax.py
+++ b/tensorflow/examples/tutorials/mnist/mnist_softmax.py
@@ -25,7 +25,6 @@ from __future__ import print_function
import argparse
import sys
-# Import data
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
@@ -34,6 +33,7 @@ FLAGS = None
def main(_):
+ # Import data
mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=True)
# Create the model
@@ -58,8 +58,8 @@ def main(_):
train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy)
sess = tf.InteractiveSession()
- # Train
tf.global_variables_initializer().run()
+ # Train
for _ in range(1000):
batch_xs, batch_ys = mnist.train.next_batch(100)
sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})