Skip to content

Commit

Permalink
Registered local_add_sub_collector in a new SequenceDB
Browse files Browse the repository at this point in the history
  • Loading branch information
kc611 committed Nov 3, 2021
1 parent a34f399 commit 438e7ce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aesara/tensor/math_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
local_optimizer,
)
from aesara.graph.opt_utils import get_clients_at_depth
from aesara.graph.optdb import SequenceDB
from aesara.misc.safe_asarray import _asarray
from aesara.tensor.basic import (
Alloc,
Expand Down Expand Up @@ -479,7 +480,6 @@ def local_mul_switch_sink(fgraph, node):
return False


@register_canonicalize
@local_optimizer([add, sub])
def local_add_sub_collector(fgraph, node):
"""
Expand Down Expand Up @@ -3613,3 +3613,9 @@ def local_reciprocal_1_plus_exp(fgraph, node):
)
register_canonicalize(local_sigmoid_logit)
register_specialize(local_sigmoid_logit)

fastmath_db = SequenceDB()
fastmath_db.name = "fastmath_db"
fastmath_db.register(
"distributive_terms_collector", local_add_sub_collector, -5, "basic"
)

0 comments on commit 438e7ce

Please sign in to comment.