parameters: (op, grad)
return_statement: return (grad_a, grad_b)
docstring: Gradient for MatrixTriangularSolve.
docstring_summary: Gradient for MatrixTriangularSolve.
docstring_tokens: Gradient for MatrixTriangularSolve .
function: def _MatrixTriangularSolveGrad(op, grad):
    """Gradient for MatrixTriangularSolve."""
    a = op.inputs[0]
    adjoint_a = op.get_attr("adjoint")
    lower_a = op.get_attr("lower")
    c = op.outputs[0]
    grad_b = linalg_ops.matrix_triangular_solve(
        a, grad, lower=lower_a, adjoint=not adjoint_a)
    if adjoint_a:
      grad_a = -math_ops.matmul(c, grad_b, adjoint_b=True)
    else:
      grad_a = -math_ops.matmul(grad_b, c, adjoint_b=True)
    if lower_a:
      grad_a = array_ops.matrix_band_part(grad_a, -1, 0)
    else:
      grad_a = array_ops.matrix_band_part(grad_a, 0, -1)
    return (grad_a, grad_b)
function_tokens: def _MatrixTriangularSolveGrad ( op , grad ) : a = op . inputs [ 0 ] adjoint_a = op . get_attr ( "adjoint" ) lower_a = op . get_attr ( "lower" ) c = op . outputs [ 0 ] grad_b = linalg_ops . matrix_triangular_solve ( a , grad , lower = lower_a , adjoint = not adjoint_a ) if adjoint_a : grad_a = - math_ops . matmul ( c , grad_b , adjoint_b = True ) else : grad_a = - math_ops . matmul ( grad_b , c , adjoint_b = True ) if lower_a : grad_a = array_ops . matrix_band_part ( grad_a , - 1 , 0 ) else : grad_a = array_ops . matrix_band_part ( grad_a , 0 , - 1 ) return ( grad_a , grad_b )