numpy中的通用函数(ufunc)的广播机制(Broadcasting)依赖于数组shape属性
创建数组:x=array([1,2,3])y=array([1,2])直接相加,失败(ValueError):z=x+yValueError:Operandscouldnotbebroadcasttogetherwithshapes(3)提示两个数组的shape不符合广播机制查看x.shape和y.shape分别显示x.shape(3,)y.shape(2,)修改一下x.shape=(3,1)y.