Created
December 6, 2018 08:43
-
-
Save hadifar/1cec97434cd9b54657e3c82e203ed324 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with tf.Session() as sess: | |
sess.run(tf.global_variables_initializer()) | |
sess.run(train_init_op) | |
while True: | |
try: | |
_, step, c, acc = sess.run([train_step, global_step, cost, accuracy]) | |
if step % 50 == 0: | |
print("Iter " + str(step) + | |
", batch loss {:.6f}".format(c) + | |
", batch Accuracy= {:.5f}".format(acc)) | |
except tf.errors.OutOfRangeError: | |
print('training is finished...') | |
break | |
step = 0 | |
acc = 0 | |
sess.run(test_init_op) | |
while True: | |
try: | |
step = step + 1 | |
acc = acc + sess.run(accuracy) | |
except tf.errors.OutOfRangeError: | |
break | |
print('final accuracy', acc / step) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment