class_docstr: dSprites data set.
docstr: Generates examples for the dSprites data set.
  
  Args:
    filepath: path to the dSprites hdf5 file.
  
  Yields:
    Dictionaries with images, latent classes, and latent values.
docstr_tok: ["Generates","examples","for","the","dSprites","data","set",".","Args",":","filepath",":","path","to","the","dSprites","hdf5","file",".","Yields",":","Dictionaries","with","images",",","latent","classes",",","and","latent","values","."]
code: def _generate_examples(self, filepath):
      """Generates examples for the dSprites data set.
  
      Args:
        filepath: path to the dSprites hdf5 file.
  
      Yields:
        Dictionaries with images, latent classes, and latent values.
      """
      # Simultaneously iterating through the different data sets in the hdf5
      # file is >100x slower and the data set is small (26.7MB). Hence, we first
      # load everything into memory before yielding the samples.
      with tfds.core.lazy_imports.h5py.File(filepath, "r") as h5dataset:
          image_array = np.array(h5dataset["imgs"])
          class_array = np.array(h5dataset["latents"]["classes"])
          values_array = np.array(h5dataset["latents"]["values"])
  
      for i, (image, classes, values) in enumerate(
          zip(image_array, class_array, values_array)
      ):
          record = dict(
              image=np.expand_dims(image, -1),
              label_shape=classes[1],
              label_scale=classes[2],
              label_orientation=classes[3],
              label_x_position=classes[4],
              label_y_position=classes[5],
              value_shape=values[1],
              value_scale=values[2],
              value_orientation=values[3],
              value_x_position=values[4],
              value_y_position=values[5],
          )
          if self.version > "2.0.0":
              record["id"] = "{:06d}".format(i)
          yield i, record
  
imports: 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(filepath) without return types