tensorly.base.partial_fold

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

Re-folds a partially unfolded tensor

Parameters
unfoldedndarray

a partially unfolded tensor

modeint

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

shapetuple

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

skip_beginint, optional, default is 1

number of dimensions to leave untouched at the beginning

skip_endint, optional

number of dimensions to leave untouched at the end

Returns
ndarray

partially re-folded tensor