You must feed a value for placeholder tensor 'Placeholder' with dtype float......?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了You must feed a value for placeholder tensor 'Placeholder' with dtype float......?相关的知识,希望对你有一定的参考价值。

学习使用tensorflow实现卷积神经网络,显示错误如下:
InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape [128,24,24,3]
[[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[128,24,24,3], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
有大神能指教下这是哪错了?

    上面的placeholder占位符(理解为声明)没有被赋值(成为变量),为找具体的placeholder最好给它命名(定义的时候)

    查看的输入的placeholder的shape和dtype是否正确

    当输入的placeholder的shape和dtype正确时,那么注意在计算图中是否有对该placeholder(成为变量了)进行运算或重新赋值

参考技术A 上面的placeholder占位符没有被赋值 参考技术B 我之前遇到过这样的问题,我在迭代的时候送进sess里面的数据和定义结构时的dtype不同,然后我在迭代中的sess.run()中加上merged(merged = tf.summary.merge_all())就解决了 参考技术C with tf.Graph().as_defaults() as g:
with tf.Session() as sess:
# your codes
参考技术D You must feed a value for placeholder tensor 'Placeholder' with dtype float and shape
译文:您必须为占位符张量“占位符”提供一个值,该值为数据类型浮动和形状

You must feed a value for placeholder tensor 'Placeholder_2' with dtype float

在使用dropout设置了一个占位符keepProb = tf.placeholder(tf.float32)
使用sess.run(train_step, feed_dict=
keepProb: 0.6,
x_data: rand_x[:, 0:11],
x_data1: rand_x[:, 11:22],
y_target: rand_y
)
报错InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'Placeholder_2' with dtype float
[[node Placeholder_2 (defined at D:/study/test.py:45) = Placeholder[dtype=DT_FLOAT, shape=<unknown>, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
要怎么解决

参考技术A  You must feed a value for placeholder tensor 'Placeholder_2' with dtype float的意思是:你必须用dtype float为占位张量'占位符_2'提供一个值 参考技术B 这是让我翻译么,对不起,出了一个“你”,我无能为力 参考技术C 这是,是要翻译的吗…… 参考技术D 不知道,你看着办吧

以上是关于You must feed a value for placeholder tensor 'Placeholder' with dtype float......?的主要内容,如果未能解决你的问题,请参考以下文章

You must feed a value for placeholder tensor 'Placeholder' with dtype float......?

You must feed a value for placeholder tensor 'Placeholder_2' with dtype float

Tensorflow报错:InvalidArgumentError: You must feed a value for placeholder tensor 'input_y' wi

求助 Cannot feed value of shape (10000,) for Tensor 'Placeholder:0', which has shape '(?,

python -- 解决If using all scalar values, you must pass an index问题

pandas.apply expand column ValueError: If using all scalar values, you must pass a index