code: def inv_as_solve(fgraph, node):
      """
      This utilizes a boolean `symmetric` tag on the matrices.
      """
      if isinstance(node.op, (Dot, Dot22)):
          l, r = node.inputs
          if (
              l.owner
              and isinstance(l.owner.op, Blockwise)
              and isinstance(l.owner.op.core_op, MatrixInverse)
          ):
              return [solve(l.owner.inputs[0], r)]
          if (
              r.owner
              and isinstance(r.owner.op, Blockwise)
              and isinstance(r.owner.op.core_op, MatrixInverse)
          ):
              x = r.owner.inputs[0]
              if getattr(x.tag, "symmetric", None) is True:
                  return [_T(solve(x, _T(l)))]
              else:
                  return [_T(solve(_T(x), _T(l)))]
  
imports: import logging
  from typing import cast
  from pytensor.graph.rewriting.basic import copy_stack_trace, node_rewriter
  from pytensor.tensor.basic import TensorVariable, diagonal, swapaxes
  from pytensor.tensor.blas import Dot22
  from pytensor.tensor.blockwise import Blockwise
  from pytensor.tensor.elemwise import DimShuffle
  from pytensor.tensor.math import Dot, Prod, _matrix_matrix_matmul, log, prod
  from pytensor.tensor.nlinalg import MatrixInverse, det
  from pytensor.tensor.rewriting.basic import register_canonicalize, register_specialize, register_stabilize
  from pytensor.tensor.slinalg import Cholesky, Solve, SolveBase, cholesky, solve, solve_triangular
label_desc: Use image node_id 4 for calling a global function with example usage: inv_as_solve(fgraph, node) and returns: list, list, list