Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement specialized inplace rewriter for Elemwise Composite Ops #138

Closed
ricardoV94 opened this issue Dec 16, 2022 · 0 comments · Fixed by #1322
Closed

Implement specialized inplace rewriter for Elemwise Composite Ops #138

ricardoV94 opened this issue Dec 16, 2022 · 0 comments · Fixed by #1322

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Dec 16, 2022

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.

@ricardoV94 ricardoV94 added enhancement New feature or request graph rewriting labels Dec 16, 2022
@ricardoV94 ricardoV94 changed the title Implement specialized inplace rewriter for Composite Ops Implement specialized inplace rewriter for Elemwise Composite Ops Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant