class_docstr: STL-10 dataset.
docstr: Generate STL-10 examples as dicts.
  
  Args:
    filepaths (list[str]): The files to use to generate the data.
  
  Yields:
    The STL-10 examples, as defined in the dataset info features.
docstr_tok: ["Generate","STL-10","examples","as","dicts",".","Args",":","filepaths","(","list","[","str","]",")",":","The","files","to","use","to","generate","the","data",".","Yields",":","The","STL-10","examples",",","as","defined","in","the","dataset","info","features","."]
code: def _generate_examples(self, filepaths):
      """Generate STL-10 examples as dicts.
  
      Args:
        filepaths (list[str]): The files to use to generate the data.
  
      Yields:
        The STL-10 examples, as defined in the dataset info features.
      """
      filepaths = list(filepaths)
      image_path = filepaths[0]
      label_path = filepaths[1] if len(filepaths) > 1 else None
  
      with tf.io.gfile.GFile(image_path, "rb") as f:
          images = np.frombuffer(f.read(), dtype=np.uint8)
          images = np.reshape(images, (-1, 3, 96, 96))
          images = np.transpose(images, (0, 3, 2, 1))
  
      if label_path:
          with tf.io.gfile.GFile(label_path, "rb") as f:
              labels = np.copy(np.frombuffer(f.read(), dtype=np.uint8))
              # Switch to zero-based indexing.
              labels -= 1
      else:
          labels = None
  
      for index, image in enumerate(images):
          yield index, {
              "image": image,
              "label": labels[index] if labels is not None else -1,
          }
  
file_path: datasets/tensorflow_datasets/datasets/stl10/stl10_dataset_builder.py
imports: import os
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  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(filepaths) without return types