我不确定出了什么问题。我检查了这个link并尝试修复该错误,但它仍然存在。我正在尝试读取 csv 数据,然后预测列的结果。没有额外的库,只有准系统 tensorflow 才能更好地理解。有什么想法吗?
编辑:
代码:
import tensorflow as tf
filename_queue = tf.train.string_input_producer(["keystrokes-strsep.csv"])
reader = tf.TextLineReader()
key, value = reader.read(filename_queue)
# Default values, in case of empty columns. Also specifies the type of the
# decoded result.
record_defaults = [[''], [''], [''], [''], ['']]
col1, col2, col3, col4, col5 = tf.decode_csv(value, record_defaults=record_defaults)
# print tf.shape(col1)
init = tf.initialize_all_variables()
features = tf.pack([col1, col2, col3, col4])
with tf.Session() as sess:
sess.run(init)
# Start populating the filename queue.
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
for i in range(114729):
# Retrieve a single instance:
example, label = sess.run([features, col5])
coord.request_stop()
coord.join(threads)
错误:
W tensorflow/core/common_runtime/executor.cc:1102] 0x7fe343d3fa40 Compute status: Cancelled: Enqueue operation was cancelled
[[Node: input_producer/input_producer_EnqueueMany = QueueEnqueueMany[Tcomponents=[DT_STRING], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/cpu:0"](input_producer, input_producer/RandomShuffle)]]
I tensorflow/core/kernels/queue_base.cc:286] Skipping cancelled enqueue attempt
最佳答案
这实际上是操作过程中正常的信息消息,而不是错误。此消息表明当您执行 request_stop
时,有记录等待推送到队列中。特别是,您会看到您的 cvs 文件是否有超过 1200 条队列容量
记录。
关于python - 我尝试将 TensorFlow 与我自己的 csv 数据一起使用,但看到无害的 "Enqueue operation canceled"警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36947524/