ensign.sptensor.read_sptensor

read_sptensor(directory, tensor_file='tensor_data.txt', read_map_modes=True)[source]

Reads a sparse tensor file from the filesystem.

Looks for mode maps formatted as map_mode_<i>.txt and reads the metadata into sptensor if found.

Parameters
directorystr

Name of directory containing tensor data and mode maps.

tensor_filestr

Filename of sparse tensor file. Default: ‘tensor_data.txt’

read_map_modesstr

If True, read_sptensor will look for and read from existing mode map files to determine mode names and labels.

Returns
sptensorSPTensor

The sparse tensor in directory

Raises
Exception

If the sparse tensor cannot be read or is not well formed.

See also

ensign.sptensor.SPTensor

Sparse tensor class