tensorly.base
.fold
-
fold
(unfolded_tensor, mode, shape)[source] Refolds the mode-mode unfolding into a tensor of shape shape
In other words, refolds the n-mode unfolded tensor into the original tensor of the specified shape.Parameters: unfolded_tensor : ndarray
unfolded tensor of shape
(shape[mode], -1)
mode : int
the mode of the unfolding
shape : tuple
shape of the original tensor before unfolding
Returns: ndarray
folded_tensor of shape shape