code: def testSparseWithDifferentDenseShapes(self):
      def _sparse(i):
          return sparse_tensor.SparseTensorValue(
              indices=array_ops.expand_dims(
                  math_ops.range(i, dtype=dtypes.int64), 1
              ),
              values=array_ops.fill(
                  [math_ops.cast(i, dtypes.int32)], i
              ),
              dense_shape=[i],
          )
  
      dataset = dataset_ops.Dataset.range(10).map(_sparse).batch(5)
      expected_output = []
      for i in range(2):
          expected_indices = []
          expected_outputs = []
          for j in range(5):
              for k in range(i * 5 + j):
                  expected_indices.append([j, k])
                  expected_outputs.append(i * 5 + j)
          expected_output.append(
              sparse_tensor.SparseTensorValue(
                  indices=expected_indices,
                  values=expected_outputs,
                  dense_shape=[5, (i + 1) * 5 - 1],
              )
          )
      self.assertDatasetProduces(
          dataset, expected_output=expected_output
      )
  
imports: import time
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.checkpoint import checkpoint_management
  from tensorflow.python.data.experimental.ops import random_access
  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.data.util import nest
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import script_ops
  from tensorflow.python.ops.ragged import ragged_concat_ops
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_math_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import test
label_desc: Use image node_id 5 for calling the BatchTest obj's underlying member method code with example usage: obj.testSparseWithDifferentDenseShapes() and returns: sparse_tensor