TensorFlow CSV问题:未加引号的字段内部不能包含引号/ CRLF

时间:2016-02-24 16:14:01

标签: python csv tensorflow

我正在尝试使用TensorFlow Python API在具有119个功能的数字数据集上训练多层感知器。 查看文档,它似乎更适合阅读文本文件:https://www.tensorflow.org/versions/r0.7/how_tos/reading_data/index.html#file-formats

我收到以下错误:

InvalidArgumentError:未加引号的字段内部不能包含引号/ CRLF      [[Node:DecodeCSV_15 = DecodeCSV [OUT_TYPE = [DT_INT32,DT_INT32,DT_INT32,DT_INT32,DT_INT32,DT_INT32,DT_INT32],field_delim =“,”,_ device =“/ job:localhost / replica:0 / task:0 / cpu: 0“](ReaderRead_11:1,DecodeCSV_15 / record_defaults_0,DecodeCSV_15 / record_defaults_1,DecodeCSV_15 / record_defaults_2,DecodeCSV_15 / record_defaults_3,DecodeCSV_15 / record_defaults_4,DecodeCSV_15 / record_defaults_5,DecodeCSV_15 / record_defaults_6)]]

我的代码的相关部分是:

filename_queue = tf.train.string_input_producer(["my-file.csv"],   num_epochs=1)

reader = tf.TextLineReader()
key, value = reader.read(filename_queue)

record_defaults = [[1], [1], [1], [1], [1], [1], [1]]
col1, col2, col3, col4, col5, col6, col7 = tf.decode_csv(
value, record_defaults=record_defaults)
features = tf.pack([col2, col3, col4, col5, col6, col7])

我也意识到即使我开始工作,我也必须对119列做同样的事情,这有点不切实际,我想知道在TensorFlow中使用TensorFlow是否有点过分。第一名。

0 个答案:

没有答案