Consider changing Elemwise
and CAReduce
to abstract classes
#712
Labels
enhancement
New feature or request
help wanted
Extra attention is needed
important
question
Further information is requested
refactor
This issue involves refactoring
request discussion
Milestone
If we change
Elemwise
andCAReduce
to abstract classes, we can start treatingElemwise
+ scalarOp
combinations as types and more easily distinguish them and generalize their handling in code.Our
Elemwise
andCAReduce
instances are already acting as singletons, and there isn't a critical use for "dynamically" generatedElemwise
instances, so the shift to explicit subclasses won't change much. If anything, it will simplify a lot of our code, because we would be able to useisinstance(op, Add)
and cover everyElemwise(add)
that we currently need to check withisinstance(op, Elemwise) and op.scalar_op == add
and the like. It would also allow us to fix some really poor logic like thetype(node.op) == CAReduce
used here, and the brittle, convoluted type checking used here.The changes involved in this mostly involve replacing/changing the use of
scalar_elemwise
. Instead, wherescalar_elemwise
is currently used to create anElemwise
instance, we would create anElemwise
subclass and its single instance.The text was updated successfully, but these errors were encountered: