目录
一、np.dot() : 向量的内积
-
If a is an N-D array and b is a 1-D array, it is a sum product over the last axis of a and b.
-
If a is an N-D array and b is an M-D array (where
M>=2
), it is a sum product over the last axis of a and the second-to-last axis of b:
dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
举例
二、np.matmul():矩阵乘法
- (n,k),(k,m)->(n,m)
- the last dimension of x1 is the same size as the second-to-last dimension of x2
举例