2024-07-08 11:08:53 发布
网友
我正在尝试使用Tensorflow读取CSV文件:
import tensorflow as tf reader = tf.TextLineReader() key, value = reader.read("../input/training.csv")
但是,我在代码的最后一行发现了这个问题:
这是什么原因?在
您需要为您的文件创建一个队列:
filename_queue = tf.train.string_input_producer(["../input/training.csv"]) reader = tf.TextLineReader() key, value = reader.read(filename_queue)
从^{} documentation:
read( queue, name=None ) [...]queue: A Queue or a mutable string Tensor representing a handle to a Queue, with string work items.
read( queue, name=None )
[...]
queue
根据API指南的Reading from files section:
A typical pipeline for reading records from files has the following stages:The list of filenamesOptional filename shufflingOptional epoch limitFilename queueA Reader for the file formatA decoder for a record read by the readerOptional preprocessingExample queue
A typical pipeline for reading records from files has the following stages:
上面的tf.train.string_input_producer()调用从项4创建文件名队列,传入一个简单的文件名列表(项1)。tf.TextLineReader()是上述列表中的第5项。
tf.train.string_input_producer()
tf.TextLineReader()
您需要为您的文件创建一个队列:
从^{} documentation :
根据API指南的Reading from files section:
上面的
tf.train.string_input_producer()
调用从项4创建文件名队列,传入一个简单的文件名列表(项1)。tf.TextLineReader()
是上述列表中的第5项。相关问题 更多 >
编程相关推荐