code: def testCardinality(self):
      boundaries = [3, 7, 11]
      batch_sizes = [2, 2, 2, 2]
      lengths = range(1, 11)
  
      def element_gen():
          for length in lengths:
              yield ([1] * length,)
  
      element_len = lambda element: array_ops.shape(element)[0]
      dataset = dataset_ops.Dataset.from_generator(
          element_gen, (dtypes.int64,), ([None],)
      ).repeat()
      dataset = dataset.bucket_by_sequence_length(
          element_length_func=element_len,
          bucket_boundaries=boundaries,
          bucket_batch_sizes=batch_sizes,
          pad_to_bucket_boundary=True,
      )
      self.assertEqual(
          self.evaluate(dataset.cardinality()), dataset_ops.INFINITE
      )
  
imports: import random
  from absl.testing import parameterized
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import context
  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.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 7 for calling the BucketBySequenceLengthTest obj's underlying member method code with example usage: obj.testCardinality() without return types