产生 AE 的代码
x = tf.placeholder(tf.float32, [None, 784])
keep_prob = tf.placeholder("float")
for step in range(2000):
batch_xs, batch_ys = mnist.train.next_batch(BATCH_SIZE)
sess.run(train_step, feed_dict={x: batch_xs, keep_prob: (1 - DROP_OUT_RATE) }) # feed_dict
if step % 10 == 0:
summary_op = tf.merge_all_summaries()
summary_str = sess.run(summary_op, feed_dict={x: batch_xs, keep_prob: 1.0})
summary_writer.add_summary(summary_str, step)
if step % 100 == 0:
print(loss,eval(session=sess, feed_dict={x: batch_xs, keep_prob: 1.0}))
我收到的错误信息
InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float
[[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
在日志中
File "<ipython-input-9-c70541b6146b>", line 18, in <module>
x = tf.placeholder(tf.float32, [None, 784])
我不知道我需要做什么。在我看来,这些代码是有效的。