[tf.data] Update `padded_batch` documentation of exceptions.

On
https://github.com/tensorflow/tensorflow/blob/548747186a9de17e70a04a82d9e7861f669d0f48/tensorflow/python/data/ops/dataset_ops.py#L4817,
`PaddedBatchDataset` checks if each component is a Tensor. This also
returns a TypeError if a component is None.

PiperOrigin-RevId: 391824917
Change-Id: I9e1c4ffe115c29c44cd970f48e211a82f614604f
diff --git a/tensorflow/python/data/kernel_tests/padded_batch_test.py b/tensorflow/python/data/kernel_tests/padded_batch_test.py
index 08d4a3a..2908346 100644
--- a/tensorflow/python/data/kernel_tests/padded_batch_test.py
+++ b/tensorflow/python/data/kernel_tests/padded_batch_test.py
@@ -103,6 +103,26 @@
     self.assertDatasetProduces(dataset, expected_output=[[[], [], [], []]])
 
   @combinations.generate(test_base.default_test_combinations())
+  def testPaddedBatchWithDifferetElementTypes(self):
+    dataset = dataset_ops.Dataset.from_tensor_slices(
+        ([0, 1, 2, 3], ['a', 'b', 'c', 'd']))
+    dataset = dataset.padded_batch(2)
+    self.assertDatasetProduces(dataset, [([0, 1], ['a', 'b']),
+                                         ([2, 3], ['c', 'd'])])
+
+  @combinations.generate(test_base.default_test_combinations())
+  def testPaddedBatchWithEmptyTuple(self):
+    dataset = dataset_ops.Dataset.from_tensor_slices(([0, 1, 2, 3], ()))
+    dataset = dataset.padded_batch(2)
+    self.assertDatasetProduces(dataset, [([0, 1], ()), ([2, 3], ())])
+
+  @combinations.generate(test_base.default_test_combinations())
+  def testPaddedBatchWithNoneElement(self):
+    dataset = dataset_ops.Dataset.from_tensor_slices(([0, 1, 2, 3], None))
+    with self.assertRaises(TypeError):
+      dataset = dataset.padded_batch(2)
+
+  @combinations.generate(test_base.default_test_combinations())
   def testDefaultPaddedShapes(self):
 
     def fill(x):
diff --git a/tensorflow/python/data/ops/dataset_ops.py b/tensorflow/python/data/ops/dataset_ops.py
index 85fbc38..9714d85 100644
--- a/tensorflow/python/data/ops/dataset_ops.py
+++ b/tensorflow/python/data/ops/dataset_ops.py
@@ -1698,8 +1698,11 @@
       Dataset: A `Dataset`.
 
     Raises:
-      ValueError: If a component has an unknown rank, and  the `padded_shapes`
+      ValueError: If a component has an unknown rank, and the `padded_shapes`
         argument is not set.
+      TypeError: If a component is of an unsupported type. The list of supported
+        types is documented in
+        https://www.tensorflow.org/guide/data#dataset_structure.
     """
     if padded_shapes is None:
       padded_shapes = get_legacy_output_shapes(self)