三维·二维
import numpy as np
a=np.array([
[[1,1,1],[1,1,1]],
[[1,1,1],[1,1,1]]
])
print(a.shape)
b=np.array([[1,1,1,1],
[1,1,1,1],
[1,1,1,1]])
print(b.shape)
c=np.dot(a,b)
print(c)
print(c.shape)
运行结果:
(2, 2, 3)
(3, 4)
[[[3 3 3 3]
[3 3 3 3]]
[[3 3 3 3]
[3 3 3 3]]]
(2, 2, 4)
总结:
(m,n,p)·(p,q)=(m,n,q)