Skip to content

Commit 47942c7

Browse files
committed
updated check
1 parent ccdd3eb commit 47942c7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pytensor/tensor/rewriting/linalg.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,13 @@ def rewrite_inv_inv(fgraph, node):
580580
return None
581581

582582
potential_inner_inv = node.inputs[0].owner
583-
if potential_inner_inv is None:
583+
if potential_inner_inv is None or potential_inner_inv.op is None:
584584
return None
585585
# Check if its an inner solve as well, does that have b = eye
586-
solve_inv_check = True
587-
if potential_inner_inv.op and isinstance(potential_inner_inv.op, DimShuffle):
588-
return None
589-
if potential_inner_inv.op.core_op and isinstance(
590-
potential_inner_inv.op.core_op, valid_solves
591-
):
586+
solve_inv_check = True if hasattr(potential_inner_inv.op, "core_op") else False
587+
# if potential_inner_inv.op and isinstance(potential_inner_inv.op, DimShuffle):
588+
# return None
589+
if solve_inv_check and isinstance(potential_inner_inv.op.core_op, valid_solves):
592590
solve_inv_check = _find_solve_with_eye(potential_inner_inv)
593591
if not solve_inv_check:
594592
return None

0 commit comments

Comments
 (0)