class_docstr: Corrupted MNIST dataset.
docstr: Generate corrupted MNIST data.
  
  Apply corruptions to the raw images according to self.corruption_type.
  
  Args:
    data_dir: root directory of downloaded dataset
    is_train: whether to return train images or test images
  
  Yields:
    dictionary with image file and label.
docstr_tok: ["Generate","corrupted","MNIST","data",".","Apply","corruptions","to","the","raw","images","according","to","self.corruption_type",".","Args",":","data_dir",":","root","directory","of","downloaded","dataset","is_train",":","whether","to","return","train","images","or","test","images","Yields",":","dictionary","with","image","file","and","label","."]
code: def _generate_examples(self, data_dir, is_train):
      """Generate corrupted MNIST data.
  
      Apply corruptions to the raw images according to self.corruption_type.
  
      Args:
        data_dir: root directory of downloaded dataset
        is_train: whether to return train images or test images
  
      Yields:
        dictionary with image file and label.
      """
      corruption = self.builder_config.corruption
  
      if is_train:
          images_file = os.path.join(
              data_dir, corruption, _TRAIN_IMAGES_FILENAME
          )
          labels_file = os.path.join(
              data_dir, corruption, _TRAIN_LABELS_FILENAME
          )
      else:
          images_file = os.path.join(
              data_dir, corruption, _TEST_IMAGES_FILENAME
          )
          labels_file = os.path.join(
              data_dir, corruption, _TEST_LABELS_FILENAME
          )
  
      with tf.io.gfile.GFile(labels_file, mode="rb") as f:
          labels = np.load(f)
  
      with tf.io.gfile.GFile(images_file, mode="rb") as f:
          images = np.load(f)
  
      for i, (image, label) in enumerate(zip(images, labels)):
          yield i, {
              "image": image,
              "label": label,
          }
  
file_path: datasets/tensorflow_datasets/image_classification/mnist_corrupted.py
imports: import os
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  from tensorflow_datasets.image_classification import mnist
  import tensorflow_datasets.public_api
label_desc: Use image node_id 3 for calling the MNISTCorrupted obj's underlying member method code with example usage: obj._generate_examples(data_dir, is_train) without return types