Make ifelse
use Switch
when its arguments are ScalarType
ed
#1226
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
performance concern
Since
Switch
is quite literally the scalar version ofIfElse
—at least in terms of itsOp.c_code
implementation, we should consider making invocations of theifelse
helper function returnSwitch
es when its arguments areScalarType
ed.This should increase the chances that the resulting
Op
can/will be fused with other scalarOp
s to produce a single, more efficientComposite
Op
, as well as remove some minor overhead due toTensorFromScalar
andScalarFromTensor
.The same general idea can be applied through rewrites, although we'll probably get a lot of coverage using only changes like this at the interface-level. In cases where
TensorFromScalar
arguments are passed toifelse
, an undesirableIfElse
Op
would be used, and this is where a rewrite could be helpful.Originally posted by @brandonwillard in #1217 (comment)
The text was updated successfully, but these errors were encountered: