code: def tag_solve_triangular(node):
      """
      If a general solve() is applied to the output of a cholesky op, then
      replace it with a triangular solve.
  
      """
      if node.op == solve:
          if node.op.A_structure == "general":
              A, b = node.inputs  # result is solution Ax=b
              if A.owner and isinstance(A.owner.op, type(cholesky)):
                  if A.owner.op.lower:
                      return [Solve("lower_triangular")(A, b)]
                  else:
                      return [Solve("upper_triangular")(A, b)]
              if (
                  A.owner
                  and isinstance(A.owner.op, DimShuffle)
                  and A.owner.op.new_order == (1, 0)
              ):
                  (A_T,) = A.owner.inputs
                  if A_T.owner and isinstance(
                      A_T.owner.op, type(cholesky)
                  ):
                      if A_T.owner.op.lower:
                          return [Solve("upper_triangular")(A, b)]
                      else:
                          return [Solve("lower_triangular")(A, b)]
  
imports: from __future__ import absolute_import, print_function, division
  import logging
  from six import iteritems, integer_types
  from six.moves import xrange
  from theano.gof import Op, Apply
  from theano.tensor import DimShuffle, Dot
  from theano.tensor.blas import Dot22
  from theano import tensor
  import theano.tensor
  from theano.tensor.opt import register_stabilize, register_specialize, register_canonicalize
  from theano.gof import local_optimizer
  from theano.gof.opt import Optimizer
  from theano.tensor.nlinalg import MatrixInverse, matrix_inverse, extract_diag, trace, det
  from theano.tensor.slinalg import Cholesky, cholesky, Solve, solve, imported_scipy
label_desc: Use image node_id 10 for calling a global function with example usage: tag_solve_triangular(node) and returns: list, list, list, list