Skip to content

Implement specialized inplace rewriter for Elemwise Composite Ops #138

Closed
@ricardoV94

Description

@ricardoV94

Description

#121 disables the inplacing of Elemwise Composite Ops to cases with more than one output, as the InplaceElemwiseOptimizer was otherwise faulty for Composites that have nested outputs

https://github.com/ricardoV94/pytensor/blob/da357175b8026be14f3d5cf329f4572b5e0349cb/pytensor/tensor/rewriting/elemwise.py#L33

One simple solution for multiple outputs, is to only allow in-placing from the last toposorted output. Otherwise, if we want to support multiple inplacing we can try something fancier by introspecting the inner graph.

Currently there is no good utility we can reuse. IIRC PyTensor usually attempts brute-force inplacing rewrite and backtracks when that would invalidate the graph. That approach doesn't sound great, so I suggest we try something else.

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