$x$ is an $N \times M$ matrix.
$y$ is a $1 \times L$ vector.
I want to return "outer product" between $x$ and $y$, let's call it $z$.
z[n,m,l] = x[n,m] * y[l]
I could probably do this using
np.einsum("ij,k->ijk", x[:, :, k], y[:, k])
np.outer(x[:, :, k], y).reshape((x.shape,x.shape,y.shape))
But I'm thinking of doing this in
np.outer only or something seems simpler, memory efficient.
Is there a way?