Skip to content

Commit 3f85e50

Browse files
committed
simplify condition and change to specialize
1 parent 1bce3d5 commit 3f85e50

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pytensor/tensor/rewriting/math.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,15 @@ def local_sqrt_sqr(fgraph, node):
552552
return [new_out]
553553

554554

555-
@register_canonicalize
555+
@register_specialize
556556
@node_rewriter([log])
557557
def local_log_sqrt(fgraph, node):
558558
x = node.inputs[0]
559559

560-
if not (x.owner and isinstance(x.owner.op, Elemwise)) and isinstance(
561-
x.owner.op.scalar_op, ps.Sqrt
560+
if (
561+
not x.owner
562+
or not isinstance(x.owner.op, Elemwise)
563+
or not isinstance(x.owner.op.scalar_op, ps.Sqrt)
562564
):
563565
return
564566

0 commit comments

Comments
 (0)