code: def testGradientOfGatherWithDefun(self):
      v = resource_variable_ops.ResourceVariable([0.0, 1.0, 2.0])
  
      def sum_gather():
          return math_ops.reduce_sum(array_ops.gather(v, [1, 2]))
  
      grad_fn = backprop.implicit_grad(sum_gather)
      gradient = grad_fn()
      defun_grad_fn = backprop.implicit_grad(
          polymorphic_function.function(sum_gather)
      )
      defun_gradient = defun_grad_fn()
      self.assertEqual(len(gradient), len(defun_gradient))
  
      gradient = gradient[0][0]
      defun_gradient = defun_gradient[0][0]
      self.assertAllEqual(gradient.values, defun_gradient.values)
      self.assertAllEqual(gradient.indices, defun_gradient.indices)
      self.assertAllEqual(
          gradient.dense_shape, defun_gradient.dense_shape
      )
  
imports: from absl.testing import parameterized
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.eager.polymorphic_function import polymorphic_function
  from tensorflow.python.framework import config
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  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 cond
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_grad
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import test
label_desc: Use image node_id 26 for calling the FunctionGradientsTest obj's underlying member method code with example usage: obj.testGradientOfGatherWithDefun() and returns: math_ops