You must feed a value for placeholder tensor 'Placeholder_1' with dtype float and shape [?,10]

1. 首先检查自己feed给tensor的数据类型与大小与placeholder所得到的tensor的是否相同,如果不同就改成相同的,如果相同,请看下面:

2. 原文链接:http://www.itkeyword.com/doc/7197603979214654287/tensorflow-issue-with-placeholder-and-summaries

The problem here is that some of the summaries in your graph—collected by tf.merge_all_summaries()depend on your placeholders. For example, the code in cifar10.py creates summaries for various activations at each step, which depend on the training example used.

The solution is to feed the same training batch when you evaluate summary_op:

if step % 100 == 0:
  summary_str = sess.run(summary_op, feed_dict={
      images: image[offset:(offset + batch_size)],
      images2: image_p[offset:(offset + batch_size)],
      labels: 1.0 * label[offset:(offset + batch_size)]})

While this gives the smallest modification to your original code, it is slightly inefficient, because it will re-execute the training step every 100 steps. The best way to address this (although it will require some restructuring of your training loop) is to fetch the summaries in the same call to sess.run() that performs a training step:

if step % 100 == 0:
  _, loss_value, summary_str = sess.run([train_op, loss, summary_op], feed_dict={
      images: image[offset:(offset + batch_size)],
      images2: image_p[offset:(offset + batch_size)],
      labels: 1.0 * label[offset:(offset + batch_size)]})
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值