代码:
conv2 = conv2d(conv1, weights['wc2'], biases['bc2'])
# Max Pooling (down-sampling)
conv2 = maxpool2d(conv2, k=2)
with tf.Session() as sess:
print(sess.run(conv2))
InvalidArgumentError(请参阅上面的回溯):您必须提供值 对于带有dtype float的placeh较旧的张量'占位符' [[Node:Placeholder = Placeholderdtype = DT_FLOAT,shape = [],_ device =“/ j ob:localhost / replica:0 / task:0 / cpu:0”]]
答案 0 :(得分:1)
conv1
生成了对占位符张量的一些操作。您应该将数据提供给来电sess.run(conv2)
。来自this page的tf.placeholder
示例:
x = tf.placeholder(tf.float32, shape=(1024, 1024))
y = tf.matmul(x, x)
with tf.Session() as sess:
print(sess.run(y)) # ERROR: will fail because x was not fed.
rand_array = np.random.rand(1024, 1024)
print(sess.run(y, feed_dict={x: rand_array})) # Will succeed.