I have a two 1 dimensional arrays, a such that np.shape(a) == (n,) and b such that np.shape(b) == (m,).
I want to make a (3rd order) tensor c such that np.shape(c) == (n,n,m,)by doing c = np.outer(np.outer(a,a),b).
But when I do this, I get:
>> np.shape(c)
(n*n,m)
which is just a rectangular matrix. How can I make a 3D tensor like I want?
np.outerflattens the input as described in the docs... are you maybe searching fornp.kron?np.kron(b,np.kron(a,a)).reshape(m,n,n)gives what I wanted, although indeces are reversed. But that's clean so I'll use this I think.