Skip to content

Commit ea42689

Browse files
committed
removed hasattr check
1 parent e6af529 commit ea42689

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytensor/tensor/rewriting/linalg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def rewrite_inv_inv(fgraph, node):
599599
valid_solves = (Solve, SolveTriangular)
600600
# Check if its a valid inverse operation (either inv/pinv or if its solve, then b = eye)
601601
inv_check = False
602-
if hasattr(node.op, "core_op") and isinstance(node.op.core_op, valid_inverses):
602+
if isinstance(node.op, Blockwise) and isinstance(node.op.core_op, valid_inverses):
603603
inv_check = True
604604
if isinstance(node.op.core_op, valid_solves):
605605
inv_check = _find_solve_with_eye(node)
@@ -613,7 +613,7 @@ def rewrite_inv_inv(fgraph, node):
613613

614614
# Check if its a valid inverse operation (either inv/pinv or if its solve, then b = eye)
615615
inv_check = False
616-
if hasattr(potential_inner_inv.op, "core_op") and isinstance(
616+
if isinstance(potential_inner_inv.op, Blockwise) and isinstance(
617617
potential_inner_inv.op.core_op, valid_inverses
618618
):
619619
inv_check = True

0 commit comments

Comments
 (0)