Tensor I/O

PyTaco can read and write tensors natively from three different file formats. The formats PyTaco supports are:

For both the read and write functions, the file format is inferred from the file extension. This means that the extension must be given when specifying a file name.

read(filename, fmt[, pack])

Reads a tensor from a file.

write(filename, t)

Writes a tensor to a file.

from_array(array[, copy])

Convert a NumPy array to a tensor.

from_sp_csc(matrix[, copy])

Convert a sparse scipy matrix to a CSC taco tensor.

from_sp_csr(matrix[, copy])

Convert a sparse scipy matrix to a CSR taco tensor.

to_array(t)

Converts a taco tensor to a NumPy array.

to_sp_csc(t)

Converts a taco tensor to a scipy csc_matrix.

to_sp_csr(t)

Converts a taco tensor to a scipy csr_matrix.

as_tensor(obj[, copy])

Converts array_like or scipy csr and csr to tensors.