pytensor icon indicating copy to clipboard operation
pytensor copied to clipboard

Inplace Composite and ScalarLoop Ops with multiple outputs

Open ricardoV94 opened this issue 8 months ago • 2 comments

Closes #138

This allows inplacing arbitrary number of inputs in Elemwise Composite (i.e., fused) Ops. The restriction was there because in the original codegen writing to the aliased outputs could affect the computations of other outputs that still referenced the just overridden aliased inputs.

The fix was trivial, only use the output names in the end after all nodes are computed. Until then the variables are stored in temporary variables as already happens for regular intermediate nodes in the Composite.

Did the same for ScalarLoop. The final outputs are only defined once the inner loop is finished, so no worries about aliasing too soon.

Also a typo-bug in the Numba vectorize code that's fixed.


📚 Documentation preview 📚: https://pytensor--1322.org.readthedocs.build/en/1322/

ricardoV94 avatar Mar 25 '25 22:03 ricardoV94