tensorly.base.partial_fold

partial_fold(unfolded, mode, shape, skip_begin=1, skip_end=0)[source]

Re-folds a partially unfolded tensor

Parameters:

unfolded : ndarray

a partially unfolded tensor

mode : int

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

shape : tuple

the shape of the original full tensor (including skipped dimensions)

skip_begin : int, optional, default is 1

number of dimensions to leave untouched at the beginning

skip_end : int, optional

number of dimensions to leave untouched at the end

Returns:

ndarray

partially re-folded tensor