fold

# Import statement

from hottbox.core import fold
fold(matrix, mode, shape)[source]

Fold a 2D array into a N-dimensional array.

Parameters
matrixnp.ndarray

Unfolded version of a tensor

modeint

A mode along which original tensor was unfolded into a matrix

shapetuple

Shape of the original tensor before it was unfolded

Returns
tensornp.ndarray

N-dimensional array of the original shape

Notes

At the moment it reverts unfolding operation (unfold). Will be generalised in a future