我正在使用TensorFlow 0.10.0rc0。我在Ubuntu 14.04上有CUDA Driver版本= 7.5和CUDNN 4。Tensorflow CSV解码错误
我有有这样一行简单的CSV文件:在新行已按在VIM在Ubuntu回车键添加
"field with
newline",0
。 我可以使用read_csv
函数在pandas
中读取此文件,其中文本字段显示为包含单个\n
字符。
但是当我尝试在TensorFlow读它,我得到以下错误:
tensorflow.python.framework.errors.InvalidArgumentError: Quoted field has to end with quote followed by delim or end
我张流码读取CSV使用此功能来读取单个行:
def read_single_example(filename_queue, skip_header_lines, record_defaults, feature_index, label_index):
reader = tf.TextLineReader(skip_header_lines=skip_header_lines)
key, value = reader.read(filename_queue)
record = tf.decode_csv(
value,
record_defaults=record_defaults)
features, label = record[feature_index], record[label_index]
return features, label
如果我使用pandas
读取并用空格替换所有换行符,则TensorFlow代码能够成功解析CSV。
但是,如果在TensorFlow CSV管道内部可以处理换行符,这将非常有帮助。
rfc4180规范声明允许,而python默认的csv方言是'excel',但应该可以。 – YOU