热线电话:13121318867

登录
2020-09-29 阅读量: 4780
python报错: ValueError: operands could not be broadcast together with shapes (3,3) (2,3)

问:

python报错:

ValueError: operands could not be broadcast together with shapes (3,3) (2,3)

image.png


答:

这是因为Numpy中的基本运算(加、减、乘、除、求余等等)都是元素级别的,要求两个数组的形状相同,

同时numpy的广播规则要求维度数相同的两个数组,若某个维度不同,必须其中一个数组维度为1才能进行广播,

而这两个数组不符合以上的要求,无法进行元素的运算。

85.4806
0
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子