码迷,mamicode.com
首页 > 其他好文 > 详细

ValueError: Cannot feed value of shape (2,) for Tensor u'Placeholder_2:0', which has shape '(1, 2)'

时间:2018-06-23 00:03:49      阅读:3297      评论:0      收藏:0      [点我收藏+]

标签:html   矩阵   value   数组   sha   shape   一维数组   detail   ace   

在tensorflow中你在做数据喂养的时候你输入的是一个一维数组如:[22,33],他的shape 为(2,)

在tensorflow中一维数组是不能与同样的一维数组进行运算的,必须通过reshape成为(1,2)而

另一个一维数组必须是(2,1)才能相乘,但是在numpy中两个一维数组相乘是不会报错的,

这个原因是在tensorflow中向量是不能和矩阵进行运算的,你需要把他改成二维的矩阵才能运算;

另外给大家补充一下reshape 和shape的知识:

shape:链接:https://blog.csdn.net/weixin_38859557/article/details/80778820

reshape:链接:https://www.cnblogs.com/bluesl/p/9215766.html

 

ValueError: Cannot feed value of shape (2,) for Tensor u'Placeholder_2:0', which has shape '(1, 2)'

标签:html   矩阵   value   数组   sha   shape   一维数组   detail   ace   

原文地址:https://www.cnblogs.com/bluesl/p/9215775.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!