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_tensorndarray
unfolded tensor of shape
(shape[mode], -1)
- modeint
the mode of the unfolding
- shapetuple
shape of the original tensor before unfolding
- Returns:
- ndarray
folded_tensor of shape shape