unfold

# Import statement

from hottbox.core import unfold
unfold(tensor, mode)[source]

Unfolds N-dimensional array into a 2D array.

Parameters
tensornp.ndarray

N-dimensional array to be unfolded

modeint

Specifies a mode along which a tensor will be unfolded

Returns
matrixnp.ndarray

Unfolded version of a tensor with a shape (tensor.shape[mode], -1)