ENH rewrite: vectorizing ops automatically (e.g. multiple distributions transformed to a single multivariate distribution) #1984
-
|
In a general sense, the following are roughly equivalent (with the latter two requiring a flattening to match the original dimensions): I intuitively imagine that the computational graph is more efficient with the latter two than the former, given the number of ops is reduced in favor of increasing the tensor dimensionality. However, it seems from a quick investigation (using Claude) scipp-atlas/pyhs3#18 that this is not the case. I'm unsure of existing prior work. I'm told that this is something that |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
what do you mean with We can still have rewrites that are opt-in. They come in handy in different workflows. This is not specific to RVs, Any operation with batch semantics (Elemwise, Blockwise..., and where you can guarantee inputs would go nicely in a square tensor) could fit the mold. |
Beta Was this translation helpful? Give feedback.
As a practical advice if you have an optimization idea, you should try to write equivalent numpy code that uses it vs does not use it and see if it actually comes ahead.