为什么sess.run没有第二次调用崩溃?

时间:2018-01-09 17:02:23

标签: tensorflow

我将相同的feed_dict提供给两个不同的操作,但第二个操作崩溃并出现错误:“你必须为占位符张量'input_tensor / TrainImage'提供一个值,其中dtype为float和shape [?,60,30,1]”

optimizer = tf.train.AdamOptimizer(learning_rate, 0.9).minimize(loss = loss,global_step=globalstep )  

merged = tf.summary.merge_all()
accuary_sum = tf.summary.scalar('Accuracy', accuracy)
accuary_sum_training = tf.summary.scalar('AccuaryTraining',accuracy)  

...(打开sess等)

 feed=self.feed_dict(True,self.step)
      acc,_ = sess.run([accuracy,optimizer],feed_dict=feed )  %works fine
      try:
        summary,sumacc= sess.run([merged,accuary_sum_training],feed)%doesnt work

错误提出: tf_session.TF_Run(session, options, feed_dict, fetch_list, target_list, status, run_metadata)

1 个答案:

答案 0 :(得分:0)

您正在运行不同的操作。假设第一个张量(准确度,优化器)不依赖于傻瓜,而后来的操作则是(合并,accuracy_sum_training)。