Yields examples.

def _generate_examples(self, file_id, extracted_dirs):
    """Yields examples."""
    filedir = os.path.join(extracted_dirs["img_align_celeba"],
                           "img_align_celeba")
    img_list_path = extracted_dirs["list_eval_partition"]
    landmarks_path = extracted_dirs["landmarks_celeba"]
    attr_path = extracted_dirs["list_attr_celeba"]

    with tf.io.gfile.GFile(img_list_path) as f:
      files = [
          line.split()[0]
          for line in f.readlines()
          if int(line.split()[1]) == file_id
      ]

    attributes = self._process_celeba_config_file(attr_path)
    landmarks = self._process_celeba_config_file(landmarks_path)

    for file_name in sorted(files):
      path = os.path.join(filedir, file_name)

      yield {
          "image": path,
          "landmarks": {
              k: v for k, v in zip(landmarks[0], landmarks[1][file_name])
          },
          "attributes": {
              # atributes value are either 1 or -1, so convert to bool
              k: v > 0 for k, v in zip(attributes[0], attributes[1][file_name])
          },
      }