tensorly.cp_tensor.cp_to_vec

cp_to_vec(cp_tensor)[source]

Turns the khatri-product of matrices into a vector

(the tensor factors = [|U_1, ... U_n|] is converted into a raveled mode-0 unfolding)

Parameters:
cp_tensorCPTensor = (weight, factors)

factors is a list of matrices, all with the same number of columns i.e.:

for u in U:
    u[i].shape == (s_i, R)

where R is fixed while s_i can vary with i

Returns:
ndarray

vectorised tensor