【发布时间】:2019-02-07 20:43:21
【问题描述】:
按照 mnist 简单示例运行简单的逻辑回归 我的代码:
x = np.array(xHotdog + xNotHotdog)
y = np.array(yHotdog + yNotHotdog)
print("y shape before: "+str(y.shape))
y = tf.one_hot(indices=y, depth=2)
print("y shape after: "+str(y.shape))
y.eval()
return x,y
稍后我运行:
sess.run([optimizer, cost], feed_dict={x: batch_xs,y: batch_ys})
得到错误:
TypeError:提要的值不能是 tf.Tensor 对象。 可接受的提要值包括 Python 标量、字符串、列表、numpy ndarrays 或 TensorHandles。作为参考,张量对象是 已通过的 Tensor("one_hot:0", shape=(6457, 2), dtype=float32) 使用键 Tensor("Placeholder_1:0", shape=(?, 2), dtype=float32)。
【问题讨论】:
标签: tensorflow