tensorly.base.unfold

unfold(tensor, mode)[source]

Returns the mode-mode unfolding of tensor with modes starting at 0.

Parameters:
tensorndarray
modeint, default is 0

indexing starts at 0, therefore mode is in range(0, tensor.ndim)

Returns:
ndarray

unfolded_tensor of shape (tensor.shape[mode], -1)