class_docstr: Test for tri-diagonal matrix related ops.
code: def _gradientTest(
      self,
      diags,
      rhs,
      y,  # output = reduce_sum(y * tridiag_solve(diags, rhs))
      expected_grad_diags,  # expected gradient of output w.r.t. diags
      expected_grad_rhs,  # expected gradient of output w.r.t. rhs
      diags_format="compact",
      transpose_rhs=False,
      feed_dict=None,
  ):
      expected_grad_diags = np.array(expected_grad_diags).astype(
          np.float32
      )
      expected_grad_rhs = np.array(expected_grad_rhs).astype(np.float32)
      with self.session() as sess, self.test_scope():
          diags = _tfconst(diags)
          rhs = _tfconst(rhs)
          y = _tfconst(y)
  
          x = linalg_impl.tridiagonal_solve(
              diags,
              rhs,
              diagonals_format=diags_format,
              transpose_rhs=transpose_rhs,
              conjugate_rhs=False,
              partial_pivoting=False,
          )
  
          res = math_ops.reduce_sum(x * y)
          actual_grad_diags = sess.run(
              gradient_ops.gradients(res, diags)[0], feed_dict=feed_dict
          )
          actual_rhs_diags = sess.run(
              gradient_ops.gradients(res, rhs)[0], feed_dict=feed_dict
          )
      self.assertAllClose(expected_grad_diags, actual_grad_diags)
      self.assertAllClose(expected_grad_rhs, actual_rhs_diags)
  
imports: import numpy
  from tensorflow.compiler.tests import xla_test
  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 test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradients
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.linalg import linalg_impl
  from tensorflow.python.platform import test
label_desc: Use image node_id 30 for calling the TridiagonalSolveOpsTest obj's underlying member method code with example usage: obj._gradientTest(diags, rhs, y, expected_grad_diags, expected_grad_rhs, diags_format, transpose_rhs, feed_dict) without return types