code: def get_predictions(
      classifier: BaseEstimator,
      X: modALinput,
      dropout_layer_indexes: list = [],
      num_predictions: int = 50,
      sample_per_forward_pass: int = 1000,
      logits_adaptor: Callable[
          [torch.tensor, modALinput], torch.tensor
      ] = default_logits_adaptor,
  ):
      """
      Runs num_predictions times the prediction of the classifier on the input X
      and puts the predictions in a list.
  
      Args:
          classifier: The classifier for which the labels are to be queried.
          X: The pool of samples to query from.
          dropout_layer_indexes: Indexes of the dropout layers which should be activated
              Choose indices from : list(torch_model.modules())
          num_predictions: Number of predictions which should be made
          sample_per_forward_pass: max. sample number for each forward pass.
              The allocated RAM does mainly depend on this.
              Small number --> small RAM allocation
          logits_adaptor: Callable which can be used to adapt the output of a forward pass
              to the required vector format for the vectorised metric functions
      Return:
          prediction: list with all predictions
      """
  
      assert (
          num_predictions > 0
      ), "num_predictions must be larger than zero"
      assert (
          sample_per_forward_pass > 0
      ), "sample_per_forward_pass must be larger than zero"
  
      predictions = []
      # set dropout layers to train mode
      set_dropout_mode(
          classifier.estimator.module_,
          dropout_layer_indexes,
          train_mode=True,
      )
  
      split_args = []
  
      if isinstance(X, Mapping):  # check for dict
          for k, v in X.items():
              v.detach()
              split_v = torch.split(v, sample_per_forward_pass)
              # create sub-dictionary split for each forward pass with same keys&values
              for split_idx, split in enumerate(split_v):
                  if len(split_args) <= split_idx:
                      split_args.append({})
                  split_args[split_idx][k] = split
  
      elif torch.is_tensor(X):  # check for tensor
          X.detach()
          split_args = torch.split(X, sample_per_forward_pass)
      else:
          raise RuntimeError(
              "Error in model data type, only dict or tensors supported"
          )
  
      for i in range(num_predictions):
          probas = []
  
          for samples in split_args:
              # call Skorch infer function to perform model forward pass
              # In comparison to: predict(), predict_proba() the infer()
              # does not change train/eval mode of other layers
              with torch.no_grad():
                  logits = classifier.estimator.infer(samples)
                  prediction = logits_adaptor(logits, samples)
                  mask = ~prediction.isnan()
                  prediction[mask] = prediction[mask].softmax(-1)
                  probas.append(prediction)
  
          probas = torch.cat(probas)
          predictions.append(to_numpy(probas))
  
      # set dropout layers to eval
      set_dropout_mode(
          classifier.estimator.module_,
          dropout_layer_indexes,
          train_mode=False,
      )
  
      return predictions
  
imports: from collections.abc import Mapping
  from typing import Callable
  import numpy
  import torch
  from scipy.special import entr
  from sklearn.base import BaseEstimator
  from skorch.utils import to_numpy
  from modAL.utils.data import modALinput
  from modAL.utils.selection import multi_argmax, shuffled_argmax
label_desc: Use image node_id 6 for calling a global function with example usage: get_predictions(classifier, X, dropout_layer_indexes, num_predictions, sample_per_forward_pass, logits_adaptor) and returns: predictions