I am going through the tensorflow tutorials (https://www.tensorflow.org/get_started/mnist/pros)
specifically:
with tf.Session() as sess:
  sess.run(tf.global_variables_initializer())
  for i in range(20000):
    batch = mnist.train.next_batch(50)
    if i % 100 == 0:
      train_accuracy = accuracy.eval(feed_dict={
          x: batch[0], y_: batch[1], keep_prob: 1.0})
      print('step %d, training accuracy %g' % (i, train_accuracy))
    train_step.run(feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})
Everything up to this point runs perfectly. It completes the 20,000 steps of training. But then I get to this point:
  print('test accuracy %g' % accuracy.eval(feed_dict={
      x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0})) 
and this happens:
>>>  print('test accuracy %g' % accuracy.eval(feed_dict={
  File "<stdin>", line 1
    print('test accuracy %g' % accuracy.eval(feed_dict={
    ^
IndentationError: unexpected indent
>>>      x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))
  File "<stdin>", line 1
    x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))
Now if I try and change the spacing, and print the final accuracy separately from the for loop, I get something even more unpleasant:
 print('test accuracy %g' % accuracy.eval(feed_dict={
...     x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))
Traceback (most recent call last):
 ...
tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value Variable_12
Not really sure what's going on. Any suggestions or feedback would be greatly appreciated.
Thank you
