code: def testBatchUnbatchValues(
      self, unbatched, batch_size, batched, use_only_batched_spec=False
  ):
      batched = batched()  # Deferred init because it creates tensors.
      unbatched = (
          unbatched()
      )  # Deferred init because it creates tensors.
  
      def unbatch_gen():
          for i in unbatched:
              yield i
  
      ds = dataset_ops.Dataset.from_tensors(batched)
      ds2 = ds.unbatch()
      if context.executing_eagerly():
          v = list(ds2.batch(2))
          self.assertAllEqual(v[0], batched)
  
      if not use_only_batched_spec:
          unbatched_spec = type_spec.type_spec_from_value(unbatched[0])
  
          dsu = dataset_ops.Dataset.from_generator(
              unbatch_gen, output_signature=unbatched_spec
          )
          dsu2 = dsu.batch(2)
          if context.executing_eagerly():
              v = list(dsu2)
              self.assertAllEqual(v[0], batched)
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import test_util
  from tensorflow.python.framework import type_spec
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.ops.ragged import row_partition
  from tensorflow.python.ops.ragged.dynamic_ragged_shape import DynamicRaggedShape
  from tensorflow.python.ops.structured import structured_tensor
  from tensorflow.python.ops.structured.structured_tensor import StructuredTensor
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 9 for calling the StructuredTensorSpecTest obj's underlying member method code with example usage: obj.testBatchUnbatchValues(unbatched, batch_size, batched, use_only_batched_spec) without return types