code: def load_pipeline(pipeline, input_iterator):
      """Runs a pipeline saving the output into memory.
  
      Use this instead of `run_pipeline_serial` to build a dataset on the fly
      without saving it to disk.
  
      Args:
        pipeline: A Pipeline instance.
        input_iterator: Iterates over the input data. Items returned by it are fed
            directly into the pipeline's `transform` method.
  
      Returns:
        The aggregated return values of pipeline.transform. Specifically a
        dictionary mapping dataset names to lists of objects. Each name acts
        as a bucket where outputs are aggregated.
      """
      aggregated_outputs = dict(
          (name, []) for name in pipeline.output_type_as_dict
      )
      total_inputs = 0
      total_outputs = 0
      stats = []
      for input_object in input_iterator:
          total_inputs += 1
          outputs = _guarantee_dict(
              pipeline.transform(input_object),
              list(aggregated_outputs.keys())[0],
          )
          for name, output_list in outputs.items():
              aggregated_outputs[name].extend(output_list)
              total_outputs += len(output_list)
          stats = statistics.merge_statistics(
              stats + pipeline.get_stats()
          )
          if total_inputs % 500 == 0:
              tf.logging.info(
                  "Processed %d inputs so far. Produced %d outputs.",
                  total_inputs,
                  total_outputs,
              )
              statistics.log_statistics_list(stats, tf.logging.info)
      tf.logging.info("\n\nCompleted.\n")
      tf.logging.info(
          "Processed %d inputs total. Produced %d outputs.",
          total_inputs,
          total_outputs,
      )
      statistics.log_statistics_list(stats, tf.logging.info)
      return aggregated_outputs
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import inspect
  import os.path
  from magenta.pipelines import statistics
  import six
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling a global function with example usage: load_pipeline(pipeline, input_iterator) and returns: aggregated_outputs