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)
答:
这是因为Numpy中的基本运算(加、减、乘、除、求余等等)都是元素级别的,要求两个数组的形状相同,
同时numpy的广播规则要求维度数相同的两个数组,若某个维度不同,必须其中一个数组维度为1才能进行广播,
而这两个数组不符合以上的要求,无法进行元素的运算。






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论