recpack.algorithms.util.naive_tensor2sparse

recpack.algorithms.util.naive_tensor2sparse(tensor: torch.Tensor) scipy.sparse._csr.csr_matrix

Converts torch Tensor to sparse csr_matrix.

Parameters

tensor (torch.Tensor) – Torch Tensor representation of the matrix to convert.

Returns

CSR matrix representation of the matrix.

Return type

csr_matrix