Numpy operator for multiple outer products

Viewed 117
import numpy as np
mat1 = np.random.rand(2,3)
mat2 = np.random.rand(2,5)

I wish to get a 2x3x5 tensor, where each layer is the 3x5 outer product achieved by multiplying 3x1 transposed row of mat1 by 1x5 row of mat2.

Can it be done with numpy matmul?

1 Answers
Related