|
@@ -58,12 +58,12 @@ with tf.Session() as sess:
|
|
|
avg_cost += c / total_batch
|
|
|
# Display logs per epoch step
|
|
|
if (epoch+1) % display_step == 0:
|
|
|
- print "Epoch:", '%04d' % (epoch+1), "cost=", "{:.9f}".format(avg_cost)
|
|
|
+ print("Epoch:", '%04d' % (epoch+1), "cost=", "{:.9f}".format(avg_cost))
|
|
|
|
|
|
- print "Optimization Finished!"
|
|
|
+ print("Optimization Finished!")
|
|
|
|
|
|
# Test model
|
|
|
correct_prediction = tf.equal(tf.argmax(pred, 1), tf.argmax(y, 1))
|
|
|
# Calculate accuracy
|
|
|
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
|
|
|
- print "Accuracy:", accuracy.eval({x: mnist.test.images, y: mnist.test.labels})
|
|
|
+ print("Accuracy:", accuracy.eval({x: mnist.test.images, y: mnist.test.labels}))
|