code: def testSparse(self):
      def _map_fn(i):
          return sparse_tensor.SparseTensorValue(
              indices=[[0, 0], [1, 1]],
              values=(i * [1, -1]),
              dense_shape=[2, 2],
          )
  
      def _flat_map_fn(x):
          return dataset_ops.Dataset.from_tensor_slices(
              sparse_ops.sparse_to_dense(
                  x.indices, x.dense_shape, x.values
              )
          )
  
      dataset = (
          dataset_ops.Dataset.range(10)
          .map(_map_fn)
          .flat_map(_flat_map_fn)
      )
      expected_output = []
      for i in range(10):
          for j in range(2):
              expected_output.append([i, 0] if j % 2 == 0 else [0, -i])
      self.assertDatasetProduces(
          dataset, expected_output=expected_output
      )
  
imports: import random
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.client import session
  from tensorflow.python.data.kernel_tests import checkpoint_test_base
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import options
  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 function
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import sparse_ops
  from tensorflow.python.ops import stateless_random_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops.ragged import ragged_conversion_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import test
  from tensorflow.python.training import server_lib
label_desc: Use image node_id 5 for calling the FlatMapTest obj's underlying member method code with example usage: obj.testSparse() and returns: sparse_tensor, dataset_ops