tensorly.kruskal_tensor
.kruskal_to_tensor

kruskal_to_tensor
(factors, weights=None)[source] Turns the Khatriproduct of matrices into a full tensor
factor_matrices = [U_1, ... U_n]
becomes a tensor shape(U[1].shape[0], U[2].shape[0], ... U[1].shape[0])
Parameters: factors : ndarray list
list of factor matrices, all with the same number of columns i.e. for all matrix U in factor_matrices: U has shape
(s_i, R)
, where R is fixed and s_i varies with iReturns: ndarray
full tensor of shape
(U[1].shape[0], ... U[1].shape[0])
Notes
This version works by first computing the mode0 unfolding of the tensor and then refolding it.
There are other possible and equivalent alternate implementation, e.g. summing over r and updating an outer product of vectors.