code: def testPaddedBatchDataset(
      self, count, padded_shapes, drop_remainder
  ):
      seq_lens = np.random.randint(20, size=(count,)).astype(np.int32)
      batch_size = 4
      dataset = (
          dataset_ops.Dataset.from_tensor_slices(seq_lens)
          .map(lambda x: array_ops.fill([x], x))
          .padded_batch(
              batch_size=batch_size,
              drop_remainder=drop_remainder,
              padded_shapes=padded_shapes,
          )
      )
  
      num_full_batches = len(seq_lens) // batch_size
      get_next = self.getNext(dataset)
      for i in range(num_full_batches):
          result = self.evaluate(get_next())
          padded_len = padded_shapes[0]
          if padded_len is None or padded_len == -1:
              padded_len = np.max(result) if result.size > 0 else 0
          self.assertEqual((batch_size, padded_len), result.shape)
          for j in range(batch_size):
              seq_len = seq_lens[(i * batch_size) + j]
              self.assertAllEqual(
                  result[j, :seq_len], [seq_len] * seq_len
              )
              self.assertAllEqual(
                  result[j, seq_len:], [0] * (padded_len - seq_len)
              )
  
      if not drop_remainder and len(seq_lens) % batch_size > 0:
          result = self.evaluate(get_next())
          padded_len = padded_shapes[0]
          if padded_len is None or padded_len == -1:
              padded_len = np.max(result) if result.size > 0 else 0
          self.assertEqual(
              (len(seq_lens) % batch_size, padded_len), result.shape
          )
          for j in range(len(seq_lens) % batch_size):
              seq_len = seq_lens[num_full_batches * batch_size + j]
              self.assertAllEqual(
                  result[j, :seq_len], [seq_len] * seq_len
              )
              self.assertAllEqual(
                  result[j, seq_len:], [0] * (padded_len - seq_len)
              )
  
      with self.assertRaises(errors.OutOfRangeError):
          self.evaluate(get_next())
      with self.assertRaises(errors.OutOfRangeError):
          self.evaluate(get_next())
  
imports: from absl.testing import parameterized
  import numpy
  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 sparse_tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import string_ops
  from tensorflow.python.ops.ragged import ragged_tensor_value
  from tensorflow.python.platform import test
  from tensorflow.python.util import compat
label_desc: Use image node_id 1 for calling the PaddedBatchTest obj's underlying member method code with example usage: obj.testPaddedBatchDataset(count, padded_shapes, drop_remainder) without return types