Skip to content

Fuse subgraphs that share common inputs #249

Open
@ricardoV94

Description

@ricardoV94

After #121 our Fusion rewrite still does not merge subgraphs that share some inputs but are otherwise not connected

import pytensor
import pytensor.tensor as pt

x = pt.vector("x")
y1 = pt.exp(pt.sin(x))
y2 = pt.sin(pt.exp(x))
fn = pytensor.function([x], [y1, y2])

pytensor.dprint(fn)

That is added as an xfail test for now. I consider that an improvement we can do in a follow-up. I would do it as a rewrite that tries to combine multiple Composites with common inputs, done after the Fusion rewrite.

Originally posted by @ricardoV94 in #121 (comment)

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