ensign.synchronize_labels.synchronize_labels

synchronize_labels(tensor_dirs, modes_to_sync=None, modes_to_sort=[], output=None, in_place=False, verbose=False)[source]

Synchronizes labels between tensors. Rewrites each tensor in terms of the new label indices. Does not preserve the ordering of any mode maps.

Parameters
tensor_dirslist of str or CPDecomp/SPTensor

Paths to directories containing tensors to be synchronized. Or CPDecomp/SPTensor objects. The tensor in the zeroeth place is treated as tensor 0, tensor in place one will be treated as tensor 1, etc.

modes_to_synclist of lists of int

Specifies which modes of each tensor to synchronize. e.g. [[0,1,2], [1,2,3]] synchronizes modes 0,1,2 of tensor 0 to modes 1,2,3 of tensor 1 respectively. Default: synchronizes all modes seen in the initial tensor.

modes_to_sort: list of int

Specifies which of the synchronized mode tuples, indexed from zero, given in modes_to_sync will be sorted according to their labels. For example, if modes_to_sync is [[1,2,3],[4,5,6]] and modes_to_sort is [0,2] then the (first tensor mode, second tensor mode) synchronized tuples are (1,4), (2,5), and (3,6) and modes 1 and 3 of the first tensor and modes 4 and 6 of the second tensor will be sorted.

outputstr

Directory to save the synchronized base and update to. Directories named ‘base’ and ‘update’ in the output directory will be overwritten. Default: Do not save to disk.

in_placebool

Overwrite the specified base_dir and update_dir. If toggled, the output option will be ignored. Default: False

verbosebool

Display verbose output. Default: False

Returns
list of CPDecomp/SPTensor

List of synchronized CPDecomp and/or SPTensor objects.