code: def average_predictions(predictions):
      """
      Returns the average of all predictions.
  
      Parameters
      ----------
      predictions : list
          Predictions (i.e. NN activation functions).
  
      Returns
      -------
      numpy array
          Averaged prediction.
  
      Notes
      -----
      If `predictions` is a list of tuples (the output of a multi-task network),
      the tuple's elements are averaged separately, i.e. the first elements, all
      second elements and so on.
  
      """
      # predictions has length 1, thus there's nothing to average
      if len(predictions) == 1:
          return predictions[0]
  
      def avg(pred):
          """Average predictions."""
          return sum(pred) / len(pred)
  
      # average predictions
      # if the network is a multi-task network, it returns tuples
      if isinstance(predictions[0], tuple):
          # FIXME: checking for tuples may be a bit fragile
          avg_pred = []
          # average the tuple's elements one by one
          for pred in list(zip(*predictions)):
              avg_pred.append(avg(pred))
          return tuple(avg_pred)
      # normal network
      else:
          # average predictions
          return avg(predictions)
  
file_path: madmom/madmom/ml/nn/__init__.py
imports: from __future__ import absolute_import, division, print_function
  import numpy
  from ...processors import Processor, ParallelProcessor, SequentialProcessor
label_desc: Use image node_id 1 for calling a global function with example usage: average_predictions(predictions) and returns: predictions, unknown, tuple, avg