在循环中使用线程时,Tensorflow代码异常退出

时间:2017-09-13 21:54:37

标签: tensorflow

我想尽可能多地描述我的问题以获得有价值的答案。为此,我发布了下面的伪代码,然后指出了我的进一步问题:

for _ in range(100):
   tf.reset_default_graph()
   read data from the queue
   build the graph
   with tf.Session() as sess:
       coord = tf.train.Coordinator()
       threads = tf.train.start_queue_runners(sess, coord)
       try:
            for i in range(total_steps):
                if coord.should_stop():
                  do my work...
       except tf.errors.OutOfRangeError:
            print('done')
       finally:
            coord.request_stop()
            coord.join(threads)

总之,我把我的代码放在循环中,并在每个循环中。重置图表,然后使用线程读取数据。

我使用了命令“nohup python myscript.py> ./ log.txt&”,而log.txt中没有异常或错误消息。

现在,我在想是线程是否导致这种异常退出?但我不确定。

非常感谢!

0 个答案:

没有答案