Skip to content

pytensor.sparse.dot returns a dense matrix even when both inputs are sparse #1855

@tomicapretto

Description

@tomicapretto

Description

As mentioned in #1854, PyTensor's dot product for sparse matrices always returns a dense array, even when both inputs are sparse. This behavior differs from SciPy's, which returns a sparse matrix when both inputs are sparse (using the format of the first input IIRC).

Note this only happens with pytensor.sparse.dot. The other operator, pytensor.sparse.structured_dot, does return a sparse matrix when both inputs are sparse.

I have not looked into pytensor.sparse.true_dot yet, but a skim suggests this one always return a sparse matrix.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions