(episodes_dir,
                            episode_index,
                            split,
                            with_info=False)
return decoded_dataset
This function reads a single episode from the directory.

  Args:
    episodes_dir: str, directory that has tf_record files.
    episode_index: int, of the episode to be loaded.
    split: str, `test` or `train`
    with_info: bool, if True reads the json file in the folder and returns
      number of

  Returns:
    decoded_dataset: tf.data.Dataset, with `image` and `label` fields.
    num_images_per_class_dict: tf.data.Dataset, if with_info=True.

  Raises:
    ValueError, when `split` is not one of {'train', 'test'}.
This function reads a single episode from the directory.
This function reads a single episode from the directory .
def read_episode_as_dataset(episodes_dir,
                            episode_index,
                            split,
                            with_info=False):
  """This function reads a single episode from the directory.

  Args:
    episodes_dir: str, directory that has tf_record files.
    episode_index: int, of the episode to be loaded.
    split: str, `test` or `train`
    with_info: bool, if True reads the json file in the folder and returns
      number of

  Returns:
    decoded_dataset: tf.data.Dataset, with `image` and `label` fields.
    num_images_per_class_dict: tf.data.Dataset, if with_info=True.

  Raises:
    ValueError, when `split` is not one of {'train', 'test'}.
  """
  episode_path = utils.get_file_path(episodes_dir, episode_index, split)
  raw_dataset = tf.data.TFRecordDataset(episode_path)
  decoded_dataset = raw_dataset.map(decoder.read_example_and_parse_image)
  if with_info:
    info_path = utils.get_info_path(episodes_dir)
    with tf.io.gfile.GFile(info_path, "r") as f:
      all_info = json.load(f)
    # Convert keys to integer.
    key = os.path.basename(episode_path)
    num_images_per_class_dict = {int(k): v for k, v in all_info[key].items()}
    return decoded_dataset, num_images_per_class_dict

  return decoded_dataset
def read_episode_as_dataset ( episodes_dir , episode_index , split , with_info = False ) : episode_path = utils . get_file_path ( episodes_dir , episode_index , split ) raw_dataset = tf . data . TFRecordDataset ( episode_path ) decoded_dataset = raw_dataset . map ( decoder . read_example_and_parse_image ) if with_info : info_path = utils . get_info_path ( episodes_dir ) with tf . io . gfile . GFile ( info_path , "r" ) as f : all_info = json . load ( f ) # Convert keys to integer. key = os . path . basename ( episode_path ) num_images_per_class_dict = { int ( k ) : v for k , v in all_info [ key ] . items ( ) } return decoded_dataset , num_images_per_class_dict return decoded_dataset