我正在使用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