tensorly.base.vec_to_tensor

vec_to_tensor(vec, shape)[source]

Folds a vectorised tensor back into a tensor of shape shape

Parameters:
vec1D-array

vectorised tensor of shape (i_1 * i_2 * ... * i_n)

shapetuple

shape of the ful tensor

Returns:
ndarray

tensor of shape shape = (i_1, ..., i_n)