code: def singlepass(fn):
      """
      Will take the mean of the iterations if needed.
  
      Args:
          fn (Callable): Heuristic function.
  
      Returns:
          fn : Array -> Array
  
      """
  
      @_wraps(fn)
      def wrapper(self, probabilities):
          if probabilities.ndim >= 3:
              # Expected shape : [n_sample, n_classes, ..., n_iterations]
              probabilities = probabilities.mean(-1)
          return fn(self, probabilities)
  
      return wrapper
  
imports: import types
  import warnings
  from collections.abc import Sequence
  from functools import wraps
  from typing import List
  import numpy
  import scipy.stats
  import torch
  from scipy.special import xlogy
  from torch import Tensor
  from baal.utils.array_utils import to_prob
label_desc: Use image node_id 2 for calling a global function with example usage: singlepass(fn) and returns: wrapper, fn