code: def TriAngSolveCompositeGrad(l, grad):
      # Gradient is l^{-H} @ ((l^{H} @ grad) * (tril(ones)-1/2*eye)) @ l^{-1}
  
      # Compute ((l^{H} @ grad) * (tril(ones)-1/2*eye)) = middle
      middle = math_ops.matmul(l, grad, adjoint_a=True)
      middle = array_ops.matrix_set_diag(
          middle, 0.5 * array_ops.matrix_diag_part(middle)
      )
      middle = array_ops.matrix_band_part(middle, -1, 0)
  
      # Compute l^{-H} @ middle = z
      l_inverse_middle = linalg_ops.matrix_triangular_solve(
          l, middle, adjoint=True
      )
  
      # We need to compute z @ l^{-1}. With matrix_triangular_solve we
      # actually compute l^{-H} @ z^{H} = grad. Since we later add grad^{H}
      # we can ommit the conjugate transpose here.
      z_h = math_ops.conj(array_ops.matrix_transpose(l_inverse_middle))
      grad_a = linalg_ops.matrix_triangular_solve(l, z_h, adjoint=True)
      grad_a += linalg.adjoint(grad_a)
      return grad_a * 0.5
  
imports: import numpy
  from tensorflow.python.client import session
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import linalg_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import stateless_random_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.linalg import linalg
  from tensorflow.python.platform import benchmark
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling a global function with example usage: TriAngSolveCompositeGrad(l, grad) and returns: unknown