code: def testNested(self):
      def reduce_fn(state, value):
          state["dense"] += value["dense"]
          state["sparse"] = value["sparse"]
          return state
  
      def make_sparse_fn(i):
          return sparse_tensor.SparseTensorValue(
              indices=np.array([[0, 0]]),
              values=(i * np.array([1])),
              dense_shape=np.array([1, 1]),
          )
  
      def map_fn(i):
          return {
              "dense": math_ops.cast(i, dtype=dtypes.int64),
              "sparse": make_sparse_fn(
                  math_ops.cast(i, dtype=dtypes.int64)
              ),
          }
  
      for i in range(10):
          ds = dataset_ops.Dataset.range(1, i + 1).map(map_fn)
          result = ds.reduce(map_fn(0), reduce_fn)
          result = self.evaluate(result)
          self.assertEqual(((i + 1) * i) // 2, result["dense"])
          self.assertValuesEqual(make_sparse_fn(i), result["sparse"])
  
imports: import time
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.data.experimental.ops import testing
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 6 for calling the ReduceTest obj's underlying member method code with example usage: obj.testNested() and returns: state, sparse_tensor, dict