mode_n_product

# Import statement

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

Mode-n product of a N-dimensional array with a matrix.

Parameters
tensornp.ndarray

N-dimensional array

matrixnp.ndarray

2D array

modeint

Specifies mode along which a tensor is multiplied by a matrix. The size of a tensor along this mode should be equal to the number of columns of the matrix. That is: tensor.shape[mode] = matrix.shape[1]

Returns
resultnp.ndarray

The result of the mode-n product of a tensor with a matrix along specified mode.

Notes

Result of mode-n product does not depend on the folding/unfolding convention, as long as folding and unfolding operations belong to the same convention.