I had built a convolutional neural network in tensorflow. It is trained and now I am unpacking it and performing evaluations.
import main
import Process
import I
Everything works correctly and the problem happens at the very last stage when python tries to kill threads. To do this properly you should create a train.Coordinator and pass it to your queue_runner
(no need to pass sess, as default session will be used
with tf.Session() as sess:
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
// do your things
coord.request_stop()
coord.join(threads)
Update from chat -- the program runs successfully, and the messages that are printed are due to Python killing threads while they are running as the process exits.
The messages are harmless but it's possible to avoid them by stopping threads manually using pattern below.
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord)
<do stuff>
coord.request_stop()
coord.join(threads)
a way to add coord with exception handling:
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess, coord)
try:
while not coord.should_stop():
#doing things here
except tf.errors.OutOfRangeError:
print("things done")
finally:
coord.request_stop()
then bug fixed :-)