2021
03-16
03-16
python3 numpy中数组相乘np.dot(a,b)运算的规则说明
pythonnp.dot(a,b)运算规则解析首先我们知道dot运算时不满足交换律的,np.dot(a,b)与np.dot(b,a)是不一样的另外np.dot(a,b)和a.dot(b)果是一样的1.numpy中数组相乘np.dot(a,b)运算条件:对于两数组a和b:示例一:a=np.array([[3],[3],[3]])#(3,1)b=np.array([2,2,1])#(3,)print(a,"\na的shape",a.shape)print(b,"\nb的shape",b.shape)c=b.dot(a)print(c,"\nc的shape",c.shape)输出:[3][3]]a的shape(3...
继续阅读 >