它主要是网站上教程的复制粘贴。我收到一个错误:
无效参数:ConcatOp:预期的连接维度在 [0, 0) 范围内,但得到 0 [[Node: concat = Concat[N=4, T=DT_INT32, _device="/job:localhost/replica:0/task: 0/cpu:0"](concat/concat_dim, DecodeCSV, DecodeCSV:1, DecodeCSV:2, DecodeCSV:3)]]
我的 csv 文件的内容是:
3,4,1,8,4
import tensorflow as tf
filename_queue = tf.train.string_input_producer(["test2.csv"])
reader = tf.TextLineReader()
key, value = reader.read(filename_queue)
# Default values, in case of empty columns. Also specifies the type of the
# decoded result.
record_defaults = [[1], [1], [1], [1], [1]]
col1, col2, col3, col4, col5 = tf.decode_csv(
value, record_defaults=record_defaults)
# print tf.shape(col1)
features = tf.concat(0, [col1, col2, col3, col4])
with tf.Session() as sess:
# Start populating the filename queue.
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
for i in range(1200):
# Retrieve a single instance:
example, label = sess.run([features, col5])
coord.request_stop()
coord.join(threads)