@@ -2575,8 +2575,6 @@ def local_greedy_distributor(fgraph, node):
2575
2575
register_stabilize (local_one_plus_erf )
2576
2576
register_specialize (local_one_plus_erf )
2577
2577
2578
- # Only one of the two rewrites below is needed if a canonicalization is added
2579
- # for sub(x, y) -> add(x, -y) or a specialization for add(x, -y) -> sub(x, y)
2580
2578
# 1-erf(x)=>erfc(x)
2581
2579
local_one_minus_erf = PatternNodeRewriter (
2582
2580
(sub , 1 , (erf , "x" )),
@@ -2590,21 +2588,9 @@ def local_greedy_distributor(fgraph, node):
2590
2588
register_stabilize (local_one_minus_erf )
2591
2589
register_specialize (local_one_minus_erf )
2592
2590
2593
- local_one_minus_erf2 = PatternNodeRewriter (
2594
- (add , 1 , (neg , (erf , "x" ))),
2595
- (erfc , "x" ),
2596
- allow_multiple_clients = True ,
2597
- name = "local_one_minus_erf2" ,
2598
- tracks = [erf ],
2599
- get_nodes = get_clients_at_depth2 ,
2600
- )
2601
- register_canonicalize (local_one_minus_erf2 )
2602
- register_stabilize (local_one_minus_erf2 )
2603
- register_specialize (local_one_minus_erf2 )
2604
-
2605
2591
# (-1)+erf(x) => -erfc(x)
2606
- # There is no need for erf(x)+(-1) nor erf(x) - 1, as the canonicalize will
2607
- # convert those to the matched pattern
2592
+ # There is no need for erf(x)+(-1) nor erf(x) - 1, as the `local_add_mul`
2593
+ # canonicalize will convert those to the matched pattern
2608
2594
local_erf_minus_one = PatternNodeRewriter (
2609
2595
(add , - 1 , (erf , "x" )),
2610
2596
(neg , (erfc , "x" )),
@@ -2617,8 +2603,6 @@ def local_greedy_distributor(fgraph, node):
2617
2603
register_stabilize (local_erf_minus_one )
2618
2604
register_specialize (local_erf_minus_one )
2619
2605
2620
- # Only one of the two rewrites below is needed if a canonicalization is added
2621
- # for sub(x, y) -> add(x, -y) or a specialization for add(x, -y) -> sub(x, y)
2622
2606
# 1-erfc(x) => erf(x)
2623
2607
local_one_minus_erfc = PatternNodeRewriter (
2624
2608
(sub , 1 , (erfc , "x" )),
@@ -2632,21 +2616,9 @@ def local_greedy_distributor(fgraph, node):
2632
2616
register_stabilize (local_one_minus_erfc )
2633
2617
register_specialize (local_one_minus_erfc )
2634
2618
2635
- local_one_minus_erfc2 = PatternNodeRewriter (
2636
- (add , 1 , (neg , (erfc , "x" ))),
2637
- (erf , "x" ),
2638
- allow_multiple_clients = True ,
2639
- name = "local_one_minus_erfc2" ,
2640
- tracks = [erfc ],
2641
- get_nodes = get_clients_at_depth2 ,
2642
- )
2643
- register_canonicalize (local_one_minus_erfc2 )
2644
- register_stabilize (local_one_minus_erfc2 )
2645
- register_specialize (local_one_minus_erfc2 )
2646
-
2647
- # (-1)+erfc(-x)=>erf(x)
2619
+ # erfc(-x)-1=>erf(x)
2648
2620
local_erf_neg_minus_one = PatternNodeRewriter (
2649
- (add , - 1 , (erfc , (neg , "x" ))),
2621
+ (sub , (erfc , (neg , "x" )), 1 ),
2650
2622
(erf , "x" ),
2651
2623
allow_multiple_clients = True ,
2652
2624
name = "local_erf_neg_minus_one" ,
0 commit comments