pytaco.from_sp_csr

pytaco.from_sp_csr(matrix, copy=True)

Convert a sparse scipy matrix to a CSR taco tensor.

Initializes a taco tensor from a scipy.sparse.csr_matrix object. This function copies the data by default.

Parameters
matrix: scipy.sparse.csr_matrix

A sparse scipy matrix to use to initialize the tensor.

copy: boolean, optional

If true, taco copies the data from scipy and stores it. Otherwise, taco points to the same data as scipy.

Returns
t: tensor

A taco tensor pointing to the same underlying data as the scipy matrix if copy was set to False. Otherwise, returns a taco tensor containing data copied from the scipy matrix.

Notes

The copy flag is ignored if the GPU backend is enabled. (This restriction will be lifted in future versions of taco.)