首页 > 编程语言 > 详细

typeError:The value of a feed cannot be a tf.Tensor object.Acceptable feed values include Python scalars,strings,lists.numpy ndarrays,or TensorHandles.For reference.the tensor object was Tensor...

时间:2018-04-25 19:37:50      阅读:6011      评论:0      收藏:0      [点我收藏+]

技术分享图片

技术分享图片

如上贴出了:错误信息和错误代码。

这个问题困扰了自己两天,报错大概是说输入的数据和接受的格式不一样,不能作为tensor。

后来问了大神,原因出在tf.reshape(),因为网络训练时用placeholder定义了输入格式,所以输入不能用tensor,而tf.reshape()返回结果就是一个tensor了,所以输入会报错。

因此改为了这种格式

技术分享图片

灵机一动,全都使用numpy里面的方法提供格式的转换,这样就不会产生tensor形的变量了。改完以后成功运行

 

typeError:The value of a feed cannot be a tf.Tensor object.Acceptable feed values include Python scalars,strings,lists.numpy ndarrays,or TensorHandles.For reference.the tensor object was Tensor...

原文:https://www.cnblogs.com/smartwhite/p/8946606.html

(0)
(13)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!