code: def testVariadicReduceSingleOp(self, is_v2):
      @def_function.function
      def reducer_add(op_element, acc_val):
          return (op_element + acc_val,)
  
      for dtype in set(self.numeric_types):
          values = np.array([[1, 3, 5], [4, 6, 8]], dtype=dtype)
          init_val = np.array(0, dtype=dtype)
          arg_spec = array_ops.zeros(
              [], dtype
          )  # pylint: disable=cell-var-from-loop
          reducer_func = reducer_add.get_concrete_function(
              arg_spec, arg_spec
          )
  
          def reduce(values, *, dimensions_to_reduce):
              if is_v2:
                  return xla.variadic_reduce(
                      (values,),
                      (init_val,),  # pylint: disable=cell-var-from-loop
                      dimensions_to_reduce=dimensions_to_reduce,
                      reducer=reducer_func,  # pylint: disable=cell-var-from-loop
                  )[0]
              else:
                  return gen_xla_ops.xla_variadic_reduce(
                      (values,),
                      (init_val,),  # pylint: disable=cell-var-from-loop
                      dimensions_to_reduce=dimensions_to_reduce,
                      reducer=reducer_func,  # pylint: disable=cell-var-from-loop
                  )[0]
  
          # Reduce dimension 0
          self._assertOpOutputMatchesExpected(
              functools.partial(reduce, dimensions_to_reduce=(0,)),
              args=(values,),
              expected=np.array([5, 9, 13], dtype=dtype),
          )
  
          # Reduce dimension 1
          self._assertOpOutputMatchesExpected(
              functools.partial(reduce, dimensions_to_reduce=(1,)),
              args=(values,),
              expected=np.array([9, 18], dtype=dtype),
          )
  
          # Reduce dimensions 0 and 1
          self._assertOpOutputMatchesExpected(
              functools.partial(reduce, dimensions_to_reduce=(0, 1)),
              args=(values,),
              expected=np.array(27, dtype=dtype),
          )
  
imports: import functools
  from absl.testing import parameterized
  import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.compiler.tf2xla.ops import gen_xla_ops
  from tensorflow.compiler.tf2xla.python import xla
  from local_xla.xla import xla_data_pb2
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import function
  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 array_ops_stack
  from tensorflow.python.ops import random_ops_util
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 18 for calling the XlaOpsNumericalTest obj's underlying member method code with example usage: obj.testVariadicReduceSingleOp(is_v2) and returns: unknown, xla, gen_xla_ops