class_docstr: Tests for davis dataset.
code: def _download_and_prepare_as_dataset(self, builder):
      super()._download_and_prepare_as_dataset(builder)
  
      if (
          not tf.executing_eagerly()
      ):  # Only test the following in eager mode.
          return
  
      with self.subTest("annotations_classes"):
          splits = builder.as_dataset()
          train_ex = list(splits[tfds.Split.TRAIN])[0]
          val_ex = list(splits[tfds.Split.VALIDATION])[0]
          # Check that the dataset examples contain the correct number of classes.
          self.assertSetEqual(
              set(
                  np.unique(train_ex["video"]["segmentations"].numpy())
              ),
              {0, 1},
          )
          self.assertSetEqual(
              set(np.unique(val_ex["video"]["segmentations"].numpy())),
              {0, 1, 2},
          )
  
      with self.subTest("dataset_shapes"):
          splits = builder.as_dataset()
          train_ex = list(splits[tfds.Split.TRAIN])[0]
          val_ex = list(splits[tfds.Split.VALIDATION])[0]
          train_num_frames = train_ex["metadata"]["num_frames"].numpy()
          val_num_frames = val_ex["metadata"]["num_frames"].numpy()
          # Check that the shapes of the dataset examples is correct.
          self.assertEqual(train_num_frames, 4)
          self.assertEqual(val_num_frames, 4)
          _, height, width, _ = (
              train_ex["video"]["frames"].numpy().shape
          )
          self.assertEqual(
              train_ex["video"]["frames"].numpy().shape,
              (4, height, width, 3),
          )
          self.assertEqual(
              train_ex["video"]["segmentations"].numpy().shape,
              (4, height, width, 1),
          )
          _, height, width, _ = val_ex["video"]["frames"].numpy().shape
          self.assertEqual(
              val_ex["video"]["frames"].numpy().shape,
              (4, height, width, 3),
          )
          self.assertEqual(
              val_ex["video"]["segmentations"].numpy().shape,
              (4, height, width, 1),
          )
  
imports: import numpy
  import tensorflow
  import tensorflow_datasets.public_api
  from tensorflow_datasets.video.davis import davis
label_desc: Use image node_id 1 for calling the DavisTest obj's underlying member method code with example usage: obj._download_and_prepare_as_dataset(builder) without return types