我学习机器学习所以我很快就编写了关于批处理的实践样本我发生了这个错误 .

  • 当打印只是csv文件时,我不会遇到错误

我的代码是这样的 .

import tensorflow as tf
filename_queue = tf.train.string_input_producer(['C:\\Users\\조시내\\Desktop\\data-01-test-score.csv'], shuffle=False, name='fliename_queue')

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

record_defaults = [[0.], [0.], [0.], [0.]]
xy = tf.decode_csv(value, record_defaults=record_defaults)

train_x_batch, train_y_batch = tf.train.batch([xy[0:-1], xy[-1:]], batch_size=10)

x = tf.placeholder(tf.float32, shape=[None, 3])
y = tf.placeholder(tf.float32, shape=[None, 1]) 

w = tf.Variable(tf.random_normal([3,1]), name='weight')
b = tf.Variable(tf.random_normal([1]),name='bias')

hypothesis = tf.matmul(x, w) + b
cost = tf.reduce_mean(tf.square(hypothesis - y))

optimizer = tf.train.GradientDescentOptimizer(learning_rate=1e-5)
train = optimizer.minimize(cost)

sess = tf.Session()

sess.run(tf.global_variables_initializer())

coord =tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord)

for step in range(2001):
    x_batch, y_batch = sess.run([train_x_batch, train_y_batch])
    cost_val, hy_val, _ = sess.run([cost, hypothesis,train],feed_dict={x: x_batch, y: y_batch})
    if step % 10 == 0:
        print(step, "cost: ", cost_val, "\nprediction:\n", hy_val)

coord.request_stop()
coord.join(threads)

错误1)回调中的异常BaseAsyncIOLoop._handle_events(1052,1)句柄:

错误2)UnicodeEncodeError:'utf-8'编解码器无法编码位置237中的字符'\ udcc6':不允许代理项回调中的异常BaseAsyncIOLoop._handle_events(1052,1)

错误3)OutOfRangeError:FIFOQueue'_1_batch / fifo_queue'关闭且元素不足(请求10,当前大小为0)[[Node:batch = QueueDequeueManyV2 [component_types = [DT_FLOAT,DT_FLOAT],timeout_ms = -1,_device =“/ job:localhost / replica:0 / task:0 / cpu:0“](batch / fifo_queue,batch / n)]]

在处理上述异常期间,发生了另一个异常: