(input_path, do_finegrainedness_analysis, do_imbalance_analysis)
return ways, shots, class_props, class_ids, test_logits, test_targets
Reads the data from the evaluation files.

  Args:
    input_path: The path to the event file to read from.
    do_finegrainedness_analysis: Whether to perform analysis of fine- vs coarse-
      grained tasks. This affects the tags that are necessary to find in the
      event files.
    do_imbalance_analysis: Whether to analyze performance for episodes that are
      characterized by different degrees of imbalance.

  Returns:
    ways: A list containing the 'way' of each episode.
    shots: A list containing a np.array per episode. The shape of an episode's
      array is the [way].
    class_ids: A list containing a np.array per episode which contains two class
      id's representing the two classes chosen for that binary classification.
    test_logits: A list containing a np.array per episode. The shape of an
      episode's array is [size of test set, way].
    test_targets: A list containing a np.array per episode. The shape of an
      episode's array is [size of test set]. This contains integers in the range
      from 0 to the way of the episode.

  Raises:
    ValueError: Finegrainedness analysis is requested but no summaries of
      class_ids are found for the provided split, or imbalance analysis is
      requested but no summaries of class_props are found.
Reads the data from the evaluation files.
Reads the data from the evaluation files .
def read_data(input_path, do_finegrainedness_analysis, do_imbalance_analysis):
  """Reads the data from the evaluation files.

  Args:
    input_path: The path to the event file to read from.
    do_finegrainedness_analysis: Whether to perform analysis of fine- vs coarse-
      grained tasks. This affects the tags that are necessary to find in the
      event files.
    do_imbalance_analysis: Whether to analyze performance for episodes that are
      characterized by different degrees of imbalance.

  Returns:
    ways: A list containing the 'way' of each episode.
    shots: A list containing a np.array per episode. The shape of an episode's
      array is the [way].
    class_ids: A list containing a np.array per episode which contains two class
      id's representing the two classes chosen for that binary classification.
    test_logits: A list containing a np.array per episode. The shape of an
      episode's array is [size of test set, way].
    test_targets: A list containing a np.array per episode. The shape of an
      episode's array is [size of test set]. This contains integers in the range
      from 0 to the way of the episode.

  Raises:
    ValueError: Finegrainedness analysis is requested but no summaries of
      class_ids are found for the provided split, or imbalance analysis is
      requested but no summaries of class_props are found.
  """
  split = (
      FLAGS.eval_finegrainedness_split
      if FLAGS.eval_finegrainedness else 'test')
  logging.info('Reading event file %s for summaries of split %s.', input_path,
               split)
  (ways, shots, class_props, class_ids, test_logits,
   test_targets) = [], [], [], [], [], []
  tags = set()
  for e in tf.train.summary_iterator(input_path):
    for v in e.summary.value:
      tags.add(v.tag)
      if v.tag == '{}_way'.format(split):
        ways.append(v.simple_value)
      elif v.tag == '{}_shots'.format(split):
        shots.append(tf.make_ndarray(v.tensor))
      elif v.tag == '{}_class_props'.format(split):
        class_props.append(tf.make_ndarray(v.tensor))
      elif v.tag == '{}_class_ids'.format(split):
        class_ids.append(tf.make_ndarray(v.tensor))
      elif v.tag == '{}_test_logits'.format(split):
        test_logits.append(tf.make_ndarray(v.tensor))
      elif v.tag == '{}_test_targets'.format(split):
        test_targets.append(tf.make_ndarray(v.tensor))
  if do_finegrainedness_analysis and not class_ids:
    raise ValueError(
        'No summaries found with tag: {}_class_ids. The tags that exist in the '
        'event file are: {}.'.format(split, list(tags)))
  if do_imbalance_analysis and not class_props:
    raise ValueError(
        'No summaries found with tag: {}_class_props. The tags that exist in '
        'the event file are: {}.'.format(split, list(tags)))
  return ways, shots, class_props, class_ids, test_logits, test_targets
def read_data ( input_path , do_finegrainedness_analysis , do_imbalance_analysis ) : split = ( FLAGS . eval_finegrainedness_split if FLAGS . eval_finegrainedness else 'test' ) logging . info ( 'Reading event file %s for summaries of split %s.' , input_path , split ) ( ways , shots , class_props , class_ids , test_logits , test_targets ) = [ ] , [ ] , [ ] , [ ] , [ ] , [ ] tags = set ( ) for e in tf . train . summary_iterator ( input_path ) : for v in e . summary . value : tags . add ( v . tag ) if v . tag == '{}_way' . format ( split ) : ways . append ( v . simple_value ) elif v . tag == '{}_shots' . format ( split ) : shots . append ( tf . make_ndarray ( v . tensor ) ) elif v . tag == '{}_class_props' . format ( split ) : class_props . append ( tf . make_ndarray ( v . tensor ) ) elif v . tag == '{}_class_ids' . format ( split ) : class_ids . append ( tf . make_ndarray ( v . tensor ) ) elif v . tag == '{}_test_logits' . format ( split ) : test_logits . append ( tf . make_ndarray ( v . tensor ) ) elif v . tag == '{}_test_targets' . format ( split ) : test_targets . append ( tf . make_ndarray ( v . tensor ) ) if do_finegrainedness_analysis and not class_ids : raise ValueError ( 'No summaries found with tag: {}_class_ids. The tags that exist in the ' 'event file are: {}.' . format ( split , list ( tags ) ) ) if do_imbalance_analysis and not class_props : raise ValueError ( 'No summaries found with tag: {}_class_props. The tags that exist in ' 'the event file are: {}.' . format ( split , list ( tags ) ) ) return ways , shots , class_props , class_ids , test_logits , test_targets