class_docstr: Shapes3d data set.
docstr: Generate examples for the Shapes3d dataset.
  
  Args:
    filepath: path to the Shapes3d hdf5 file.
  
  Yields:
    Dictionaries with images and the different labels.
docstr_tok: ["Generate","examples","for","the","Shapes3d","dataset",".","Args",":","filepath",":","path","to","the","Shapes3d","hdf5","file",".","Yields",":","Dictionaries","with","images","and","the","different","labels","."]
code: def _generate_examples(self, filepath):
      """Generate examples for the Shapes3d dataset.
  
      Args:
        filepath: path to the Shapes3d hdf5 file.
  
      Yields:
        Dictionaries with images and the different labels.
      """
      # Simultaneously iterating through the different data sets in the hdf5
      # file will be slow with a single file. Instead, 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["images"])
          # The 'label' data set in the hdf5 file actually contains the float values
          # and not the class labels.
          values_array = np.array(h5dataset["labels"])
  
      # We need to calculate the class labels from the float values in the file.
      labels_array = np.zeros_like(values_array, dtype=np.int64)
      for i in range(values_array.shape[1]):
          labels_array[:, i] = _discretize(
              values_array[:, i]
          )  # pylint: disable=unsupported-assignment-operation
  
      for i, (image, labels, values) in enumerate(
          zip(image_array, labels_array, values_array)
      ):
          record = {
              "image": image,
              "label_floor_hue": labels[0],
              "label_wall_hue": labels[1],
              "label_object_hue": labels[2],
              "label_scale": labels[3],
              "label_shape": labels[4],
              "label_orientation": labels[5],
              "value_floor_hue": values[0],
              "value_wall_hue": values[1],
              "value_object_hue": values[2],
              "value_scale": values[3],
              "value_shape": values[4],
              "value_orientation": values[5],
          }
          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