[问题] tensorflow读档疑问

楼主: yawilly (咖哩)   2019-04-16 21:02:06
各位大大好,小弟最近在研究tensorflow读档时有几个问题想请各位解惑。
爬文时看到的范例为:
import tensorflow as tf
filename_queue = tf.train.string_input_producer(
["iris1.csv", "iris2.csv", "iris3.csv"])
reader = tf.TextLineReader()
key, value = reader.read(filename_queue)
record_defaults = [[0.0], [0.0], [0.0], [0.0], [0]]
col1, col2, col3, col4, col5 = tf.decode_csv(
value, record_defaults=record_defaults)
features = tf.stack([col1, col2, col3, col4])
with tf.Session() as sess:
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
for i in range(10):
example, label = sess.run([features, col5])
print(example, label)
coord.request_stop()
coord.join(threads)
目前已将data分别存为三个csv档,请问将data导入的步骤是否为第二行的程式码?
程式码在两台电脑上试着运行后在session的循环时均无法运行分别产生两种错误,
分别为:
1.'utf-8' codec can't encode character '\udca8' in position 65: surrogates not
allowed
爬文后发现为档案位置不对的错误,然而在改变位置后依然为这个错误
2.一跑程式,spyder就直接跳出已停止运作的通知框
劳烦各位大大在百忙中指点迷津,谢谢各位的帮忙
作者: thefattiger (LT)   2019-04-17 00:24:00
\udca8代表inavlid char的unicode,换成UTF-16试试看再不行的话找出它在档案的哪里,直接手动删除

Links booklink

Contact Us: admin [ a t ] ucptt.com