code: def compute_all_metrics_statistics(all_results):
      """Computes statistics of metrics across multiple decodings.
  
      Args:
        all_results: dict of 3-D numpy arrays.
                     Each array has shape=(num_decodes, num_samples, num_frames).
      Returns:
        statistics: dict of 1-D numpy arrays, shape=(num_frames).
                    First the statistic (max/mean/std) is computed across the
                    decodes, then the mean is taken across num_samples.
        decode_inds: dict of 1-D numpy arrays, shape=(num_samples,)
                     Each element represents the index of the decode corresponding
                     to the best statistic.
      """
      statistics = {}
      decode_inds = {}
      all_metrics = all_results.keys()
  
      for key in all_metrics:
          values = all_results[key]
          statistics[key + "_MEAN"] = np.mean(values, axis=0)
          statistics[key + "_STD"] = np.std(values, axis=0)
          min_stats, min_decode_ind = reduce_to_best_decode(
              values, np.argmin
          )
          statistics[key + "_MIN"] = min_stats
          decode_inds[key + "_MIN_DECODE"] = min_decode_ind
          max_stats, max_decode_ind = reduce_to_best_decode(
              values, np.argmax
          )
          statistics[key + "_MAX"] = max_stats
          decode_inds[key + "_MAX_DECODE"] = max_decode_ind
  
      # Computes mean of each statistic across the dataset.
      for key in statistics:
          statistics[key] = np.mean(statistics[key], axis=0)
      return statistics, decode_inds
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import numpy
  import six
  import tensorflow.compat.v1
label_desc: Use image node_id 12 for calling a global function with example usage: compute_all_metrics_statistics(all_results) and returns: statistics,  decode_inds