class_docstr: Imagenet Resized dataset.
class_docstr_tok: ["Imagenet","Resized","dataset","."]
docstr: Yields examples.
docstr_tok: ["Yields","examples","."]
code: def _generate_examples(self, archive):
      """Yields examples."""
      for fname, fobj in archive:
          content = fobj.read()
          if content:
              fobj_mem = io.BytesIO(content)
              data = np.load(fobj_mem, allow_pickle=False)
              size = self.builder_config.size
              for i, (image, label) in enumerate(
                  zip(data["data"], data["labels"])
              ):
                  record = {
                      # The data is packed flat as CHW where as most image datasets
                      # in tensorflow are HWC. We reshape to recover CHW, then transpose
                      # to put back into HWC.
                      "image": np.reshape(
                          image, (3, size, size)
                      ).transpose(1, 2, 0),
                      # Labels in the original dataset are 1 indexed so we subtract 1
                      # here.
                      "label": label - 1,
                  }
                  yield fname + str(i), record
  
file_path: datasets/tensorflow_datasets/datasets/imagenet_resized/imagenet_resized_dataset_builder.py
imports: import io
  import itertools
  import numpy
  import tensorflow_datasets.public_api
label_desc: Use image node_id 3 for calling the Builder obj's underlying member method code with example usage: obj._generate_examples(archive) without return types