tensorly.base.vec_to_tensor

vec_to_tensor(vec, shape)[source]

Folds a vectorised tensor back into a tensor of shape shape

Parameters:

vec : 1D-array

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

shape : tuple

shape of the ful tensor

Returns:

ndarray

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