1.numpy乘法运算中"*"是数组元素逐个计算
>>> import numpy as np >>> a = np.array([[2,3],[3,4]]) >>> b = np.array([[3,4],[5,6]]) >>> c = a * b >>> c array([[ 6, 12], [15, 24]]) >>>
2.numpy乘法运算中dot是按照矩阵乘法的规则来运算的
>>> import numpy as np >>> a = np.array([[2,3],[3,4]]) >>> b = np.array([[3,4],[5,6]]) >>> c = a * b >>> f = np.dot(a,b) >>> f array([[21, 26], [29, 36]]) >>>