Outer Product of Two Matrices?

The outer product usually refers to the tensor product of vectors. If you want something like the outer product between a $m \times n$ matrix $A$ and a $p\times q$ matrix $B$, you can see the generalization of outer product, which is the Kronecker product. It is noted $A \otimes B$ and equals: $$A \otimes B = \begin{pmatrix}a_{11}B & \dots & a_{1n}B \\ \vdots & \ddots & \vdots \\ a_{m1}B & \dots & a_{mn}B\end{pmatrix}$$


To extend davcha's answer, for your specific example, you would get:

$$A\otimes B= \left( \begin{array}{cc} \left( \begin{array}{ccc} 5 & 6 & 7 \\ 8 & 9 & 10 \\ \end{array} \right) & \left( \begin{array}{ccc} 10 & 12 & 14 \\ 16 & 18 & 20 \\ \end{array} \right) \\ \left( \begin{array}{ccc} 15 & 18 & 21 \\ 24 & 27 & 30 \\ \end{array} \right) & \left( \begin{array}{ccc} 20 & 24 & 28 \\ 32 & 36 & 40 \\ \end{array} \right) \\ \end{array} \right) $$


I think @davcha and @Sandu Ursu 's answers are wrong. They have calculated the Kronecker Product. According to the definition of outer product, the outer product of A and B should be a $2×2×2×3$ tensor. You can follow this answer to compute it using numpy.