code: def _test_gradient_helper(
      self,
      rt_val,
      default_val,
      shape_val,
      output_grad,
      expected_output_val,
      expected_rt_grad,
      expected_default_grad,
  ):
      if context.executing_eagerly():
          with backprop.GradientTape() as tape:
              tape.watch([rt_val, default_val])
              out = rt_val.to_tensor(default_val, shape=shape_val)
              actual_rt_grad, actual_default_grad = tape.gradient(
                  out,
                  (rt_val, default_val),
                  output_gradients=output_grad,
              )
      else:
          out = rt_val.to_tensor(default_val, shape=shape_val)
          (
              actual_rt_grad,
              actual_default_grad,
          ) = gradients_impl.gradients(
              ys=out, xs=(rt_val, default_val), grad_ys=output_grad
          )
  
      self.assertAllClose(out, expected_output_val)
      self.assertIsInstance(actual_rt_grad, RaggedTensor)
      self.assertAllClose(actual_rt_grad, expected_rt_grad)
      self.assertAllClose(actual_default_grad, expected_default_grad)
  
imports: import random
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.client import session
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.ops.ragged.ragged_tensor import RaggedTensor
  from tensorflow.python.platform import benchmark
  from tensorflow.python.platform import googletest
  from tensorflow.python.util import nest
label_desc: Use image node_id 16 for calling the RaggedTensorToTensorOpTest obj's underlying member method code with example usage: obj._test_gradient_helper(rt_val, default_val, shape_val, output_grad, expected_output_val, expected_rt_grad, expected_default_grad) without return types