Skip to content

Add rewrite to merge multiple SVD Ops with different settings #732

@jessegrabowski

Description

@jessegrabowski

Description

SVD comes with a bunch of keyword arguments, most important of which is compute_uv. If False, it will return only the singular values for a given matrix. This is nice if you want to save on computation, but it can actually be inefficient if the user wants gradients. In the reverse mode, we need to compute the U and V matrices anyway, and indeed the L_op for SVD (added in #614 ) adds a 2nd SVD Op to the graph with compute_uv = True

When we see two SVD Ops with the same inputs on a graph, differing only by compute_uv, we should change compute_uv = False to True everywhere. This will allow pytensor to see that these outputs are equivalent and re-use them, rather than computing the decomposition multiple times.

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