class_docstr: DatasetBuilder for CIFAR-10N dataset.
class_docstr_tok: ["DatasetBuilder","for","CIFAR-10N","dataset","."]
docstr: Generate CIFAR-100N examples as dicts.
  
  Uses self._cifar_info as configuration.
  
  Args:
    split_prefix (str): Prefix that identifies the split (e.g. "tr" or "te").
    filepaths (list[str]): The files to use to generate the data.
    dl_paths (dict[str, str]): Paths to human_labels and side_info
  
  Yields:
    The cifar examples, as defined in the dataset info features.
docstr_tok: ["Generate","CIFAR-100N","examples","as","dicts",".","Uses","self._cifar_info","as","configuration",".","Args",":","split_prefix","(","str",")",":","Prefix","that","identifies","the","split","(","e.g",".","``","tr","''","or","``","te","''",")",".","filepaths","(","list","[","str","]",")",":","The","files","to","use","to","generate","the","data",".","dl_paths","(","dict","[","str",",","str","]",")",":","Paths","to","human_labels","and","side_info","Yields",":","The","cifar","examples",",","as","defined","in","the","dataset","info","features","."]
code: def _generate_examples(self, split_prefix, filepaths, dl_paths):
      """Generate CIFAR-100N examples as dicts.
  
      Uses self._cifar_info as configuration.
  
      Args:
        split_prefix (str): Prefix that identifies the split (e.g. "tr" or "te").
        filepaths (list[str]): The files to use to generate the data.
        dl_paths (dict[str, str]): Paths to human_labels and side_info
  
      Yields:
        The cifar examples, as defined in the dataset info features.
      """
      label_keys = self._cifar_info.label_keys
      index = 0  # Using index as key since data is always loaded in same order.
  
      if "train" in split_prefix:
          human_labels = _load_human_labels(dl_paths["human_labels"])
          noise_label = human_labels["noise_label"]
  
          side_info = _load_side_info(dl_paths["side_info"])
          worker_id = side_info["worker_id"]
          worker_time = side_info["worker_time"]
  
          annotations_order = _load_annotations_order(
              dl_paths["annotations_order"]
          )
  
      for path in filepaths:
          for labels, np_image in _load_data(path, len(label_keys)):
              record = dict(zip(label_keys, labels))
              # Note: "id" is only provided for the user convenience. To shuffle the
              # dataset we use `index`, so that the sharding is compatible with
              # earlier versions.
              record["id"] = "{}{:05d}".format(split_prefix, index)
              record["image"] = np_image
  
              if "train" in split_prefix:
                  # Note: The human labels are provided according to default shuffling
                  # of 'cifar100'. We need to invert the shuffling to assign the right
                  # human label to each example.
                  annotations_index = np.where(
                      annotations_order == index
                  )[0][0]
  
                  record["noise_label"] = noise_label[annotations_index]
                  # Worker metadata is shared every 5 samples
                  record["worker_id"] = worker_id[index // 5]
                  record["worker_time"] = worker_time[index // 5]
              else:
                  # There is no annotator metadata for test split
                  record["noise_label"] = -1
                  record["worker_id"] = -1
                  record["worker_time"] = -1
  
              yield index, record
              index += 1
  
file_path: datasets/tensorflow_datasets/image_classification/cifar100_n/cifar100_n.py
imports: from __future__ import annotations
  import collections
  import os
  from etils import epath
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 4 for calling the Cifar100N obj's underlying member method code with example usage: obj._generate_examples(split_prefix, filepaths, dl_paths) without return types