code: def test_generic_solve_to_solve_triangular():
      A = matrix("A")
      x = matrix("x")
  
      L = cholesky(A, lower=True)
      U = cholesky(A, lower=False)
      b1 = solve(L, x)
      b2 = solve(U, x)
      f = pytensor.function([A, x], b1)
  
      rng = np.random.default_rng(97)
      X = rng.normal(size=(10, 10)).astype(config.floatX)
      X = X @ X.T
      X_chol = np.linalg.cholesky(X)
      eye = np.eye(10, dtype=config.floatX)
  
      if config.mode != "FAST_COMPILE":
          toposort = f.maker.fgraph.toposort()
          op_list = [node.op for node in toposort]
  
          assert not any(isinstance(op, Solve) for op in op_list)
          assert any(isinstance(op, SolveTriangular) for op in op_list)
  
          assert_allclose(
              f(X, eye) @ X_chol,
              eye,
              atol=1e-8 if config.floatX.endswith("64") else 1e-4,
          )
  
      f = pytensor.function([A, x], b2)
  
      if config.mode != "FAST_COMPILE":
          toposort = f.maker.fgraph.toposort()
          op_list = [node.op for node in toposort]
          assert not any(isinstance(op, Solve) for op in op_list)
          assert any(isinstance(op, SolveTriangular) for op in op_list)
          assert_allclose(
              f(X, eye).T @ X_chol,
              eye,
              atol=1e-8 if config.floatX.endswith("64") else 1e-4,
          )
  
imports: from functools import partial
  import numpy
  import pytest
  import scipy.linalg
  from numpy.testing import assert_allclose
  import pytensor
  from pytensor import function
  from pytensor import tensor
  from pytensor.compile import get_default_mode
  from pytensor.configdefaults import config
  from pytensor.tensor import swapaxes
  from pytensor.tensor.blockwise import Blockwise
  from pytensor.tensor.elemwise import DimShuffle
  from pytensor.tensor.math import _allclose, dot, matmul
  from pytensor.tensor.nlinalg import Det, MatrixInverse, matrix_inverse
  from pytensor.tensor.rewriting.linalg import inv_as_solve
  from pytensor.tensor.slinalg import Cholesky, Solve, SolveBase, SolveTriangular, cho_solve, cholesky, solve, solve_triangular
  from pytensor.tensor.type import dmatrix, matrix, tensor, vector
  from tests import unittest_tools
  from tests.test_rop import break_op
label_desc: Use image node_id 3 for calling a global function with example usage: test_generic_solve_to_solve_triangular() without return types