code: def test_solve_triangular(
      b_func, b_size, lower, trans, unit_diag, complex
  ):
      if complex:
          # TODO: Complex raises ValueError: To change to a dtype of a different size, the last axis must be contiguous,
          #  why?
          pytest.skip(
              "Complex inputs currently not supported to solve_triangular"
          )
  
      complex_dtype = (
          "complex64" if config.floatX.endswith("32") else "complex128"
      )
      dtype = complex_dtype if complex else config.floatX
  
      A = pt.matrix("A", dtype=dtype)
      b = b_func("b", dtype=dtype)
  
      X = pt.linalg.solve_triangular(
          A, b, lower=lower, trans=trans, unit_diagonal=unit_diag
      )
      f = pytensor.function([A, b], X, mode="NUMBA")
  
      A_val = np.random.normal(size=(5, 5))
      b = np.random.normal(size=b_size)
  
      if complex:
          A_val = A_val + np.random.normal(size=(5, 5)) * 1j
          b = b + np.random.normal(size=b_size) * 1j
      A_sym = A_val @ A_val.conj().T
  
      A_tri = np.linalg.cholesky(A_sym).astype(dtype)
      if unit_diag:
          adj_mat = np.ones((5, 5))
          adj_mat[np.diag_indices(5)] = 1 / np.diagonal(A_tri)
          A_tri = A_tri * adj_mat
  
      A_tri = A_tri.astype(dtype)
      b = b.astype(dtype)
  
      if not lower:
          A_tri = A_tri.T
  
      X_np = f(A_tri, b)
      np.testing.assert_allclose(
          transpose_func(A_tri, trans) @ X_np, b, atol=ATOL, rtol=RTOL
      )
  
file_path: pytensor/tests/link/numba/test_slinalg.py
imports: import re
  import numpy
  import pytest
  import pytensor
  import pytensor.tensor
  from pytensor import config
  from pytensor.compile import SharedVariable
  from pytensor.graph import Constant, FunctionGraph
  from tests.link.numba.test_basic import compare_numba_and_py
  from tests.tensor.test_extra_ops import set_test_value
label_desc: Use image node_id 2 for calling a global function with example usage: test_solve_triangular(b_func, b_size, lower, trans, unit_diag, complex) without return types