Tensorflow警告:超出RandomShuffleUE的范围

Tensorflow警告:超出RandomShuffleUE的范围,tensorflow,Tensorflow,我有一个TFRecords文件,存储8000个列车样本。我将其加载到一个文件名队列中,并将num_epoches设置为2,这样队列中应该有16000个样本。同时,我将批处理大小设置为100,因此在队列变为空之前应该迭代160次 ... ... sess.run(init_op) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(sess=sess, coord=coord) start_time = ti

我有一个TFRecords文件,存储8000个列车样本。我将其加载到一个文件名队列中,并将
num_epoches
设置为
2
,这样队列中应该有16000个样本。同时,我将批处理大小设置为100,因此在队列变为空之前应该迭代160次

... 
...
sess.run(init_op)
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord)
start_time = time.time()
try:
    step = 0
    while not coord.should_stop():
        _, loss_value, acc_value_train, acc_value_test, summary_str \
            = sess.run([train_op, loss, acc_train, acc_test, summary_op])
        step = step + 1
        if step % 1 == 0:
            format_str = ('step %d, loss = %.2f, acc_train = %.2f, acc_test = %.2f, time: %.2f seconds')
            print(format_str % (step, loss_value, acc_value_train, acc_value_test, (time.time() - start_time)))
            summary_writer.add_summary(summary_str, step)
            start_time = time.time()
except tf.errors.OutOfRangeError:
    print('done')
finally:
    coord.request_stop()

coord.join(threads)
sess.close()
但是,当我真正运行培训代码时,我得到了以下日志:

...
step 157, loss = 4.59, acc_train = 0.12, acc_test = 0.20, time: 0.07 seconds
step 158, loss = 4.53, acc_train = 0.15, acc_test = 0.17, time: 0.07 seconds
step 159, loss = 4.44, acc_train = 0.18, acc_test = 0.21, time: 0.07 seconds
W tensorflow/core/framework/op_kernel.cc:940] Out of range: RandomShuffleQueue '_2_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 100, current size 0)
     [[Node: shuffle_batch = QueueDequeueMany[_class=["loc:@shuffle_batch/random_shuffle_queue"], component_types=[DT_FLOAT, DT_INT32], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]
W tensorflow/core/framework/op_kernel.cc:940] Out of range: RandomShuffleQueue '_2_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 100, current size 0)
     [[Node: shuffle_batch = QueueDequeueMany[_class=["loc:@shuffle_batch/random_shuffle_queue"], component_types=[DT_FLOAT, DT_INT32], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]
W tensorflow/core/framework/op_kernel.cc:940] Out of range: RandomShuffleQueue '_2_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 100, current size 0)
     [[Node: shuffle_batch = QueueDequeueMany[_class=["loc:@shuffle_batch/random_shuffle_queue"], component_types=[DT_FLOAT, DT_INT32], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]
W tensorflow/core/framework/op_kernel.cc:940] Out of range: RandomShuffleQueue '_2_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 100, current size 0)
     [[Node: shuffle_batch = QueueDequeueMany[_class=["loc:@shuffle_batch/random_shuffle_queue"], component_types=[DT_FLOAT, DT_INT32], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]
done
W tensorflow/core/framework/op_kernel.cc:940] Out of range: RandomShuffleQueue '_2_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 100, current size 0)
     [[Node: shuffle_batch = QueueDequeueMany[_class=["loc:@shuffle_batch/random_shuffle_queue"], component_types=[DT_FLOAT, DT_INT32], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]
W tensorflow/core/framework/op_kernel.cc:940] Out of range: RandomShuffleQueue '_2_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 100, current size 0)
     [[Node: shuffle_batch = QueueDequeueMany[_class=["loc:@shuffle_batch/random_shuffle_queue"], component_types=[DT_FLOAT, DT_INT32], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]

Process finished with exit code 0

您知道,自从“done”被打印后,这意味着OutOfRangeError异常已被捕获。然而,为什么在步骤159之后仍然有这么多“超出范围”的警告?

我相信这是正常的;协调员总是记录异常。我相信这是正常的;协调器总是记录异常。