python - 我尝试将 TensorFlow 与我自己的 csv 数据一起使用,但看到无害的 "Enqueue operation canceled"警告

标签 python csv tensorflow

我不确定出了什么问题。我检查了这个link并尝试修复该错误,但它仍然存在。我正在尝试读取 csv 数据,然后预测列的结果。没有额外的库,只有准系统 tensorflow 才能更好地理解。有什么想法吗?

enter image description here

编辑:

代码:

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/

相关文章:

python - 为什么 python 解释器不在 python 模式的 emacs python shell 缓冲区中打印输入代码和输出?

python - 在 Django View 中诊断 AttributeError

python - 将 f.write 文件保存到与找到的 Askopenfilename 相同的目录中

csv - 将10000个元素的Vector{BitVector}转换为1和0的矩阵并保存在Julia中

tensorflow - 更换gpu后我必须重新安装tensorflow吗?

python - 属性错误 : 'Dimension' object has no attribute 'log10' while using Keras Sequential Model. 适合

python - 如何将 boost::none 传递给 Python Quantlib

csv - 使用 beeline 引用 csv 输出

csv - Pandas to_csv() 禁用 float

csv - 我可以将 tensorflow 摘要导出为 CSV 吗?