Closed
Description
The scalar expressions seem a bit more reasonable to me (not tensors and no allocations), but since most rewrites only work on Elemwise, this can prevent a lot of optimizations right now.
I think the only thing that's needed is to allow the FusionRewrite to work on 0d tensors (right now I think it requires that ndim > 1).
Fusing chains of 0d tensors inside a Composite would have the same effect as using scalars in the graph with a small overhead from Elemwise
(but which also takes care of the otherwise needed ScalarFromTensor
and TensorFromScalar
at the inputs and outputs)?
Once we have a 0d Elemwise composite it's also trivial to replace it by the scalar case if that's more efficient.
Originally posted by @ricardoV94 in #345 (comment)