class_docstr: Interface defining Metrics' API.
docstr: If `data_batch` has no `a_batch`, will compute explanations.
  This needs to be done on batch level to avoid OOM. Additionally will set `a_axes` property if it is None,
  this can be done earliest after we have first `a_batch`.
  
  Parameters
  ----------
  data_batch:
      A single entry yielded from the generator return by `self.generate_batches(...)`
  
  Returns
  -------
  data_batch:
      Dictionary, which is ready to be passed down to `self.evaluate_batch`.
docstr_tok: ["If","`","data_batch","`","has","no","`","a_batch","`",",","will","compute","explanations",".","This","needs","to","be","done","on","batch","level","to","avoid","OOM",".","Additionally","will","set","`","a_axes","`","property","if","it","is","None",",","this","can","be","done","earliest","after","we","have","first","`","a_batch","`",".","Parameters","--","--","--","--","--","data_batch",":","A","single","entry","yielded","from","the","generator","return","by","`","self.generate_batches","(","...",")","`","Returns","--","--","--","-","data_batch",":","Dictionary",",","which","is","ready","to","be","passed","down","to","`","self.evaluate_batch","`","."]
code: def batch_preprocess(
      self, data_batch: Dict[str, Any]
  ) -> Dict[str, Any]:
      """
      If `data_batch` has no `a_batch`, will compute explanations.
      This needs to be done on batch level to avoid OOM. Additionally will set `a_axes` property if it is None,
      this can be done earliest after we have first `a_batch`.
  
      Parameters
      ----------
      data_batch:
          A single entry yielded from the generator return by `self.generate_batches(...)`
  
      Returns
      -------
      data_batch:
          Dictionary, which is ready to be passed down to `self.evaluate_batch`.
      """
  
      x_batch = data_batch["x_batch"]
  
      a_batch = data_batch.get("a_batch")
  
      if a_batch is None:
          # Generate batch of explanations lazily, so we don't hit OOM
          model = data_batch["model"]
          y_batch = data_batch["y_batch"]
          a_batch = self.explain_batch(model, x_batch, y_batch)
          data_batch["a_batch"] = a_batch
  
      if self.a_axes is None:
          self.a_axes = utils.infer_attribution_axes(a_batch, x_batch)
  
      custom_batch = self.custom_batch_preprocess(**data_batch)
      if custom_batch is not None:
          data_batch.update(custom_batch)
      return data_batch
  
imports: from __future__ import annotations
  import functools
  import logging
  import os
  import sys
  from abc import abstractmethod
  from typing import Any, Callable, ClassVar, Dict, Generator, Generic, Sequence, Set, TypeVar, Optional, Union, TYPE_CHECKING, no_type_check
  import matplotlib.pyplot
  import numpy
  from sklearn.utils import gen_batches
  from tqdm.auto import tqdm
  from quantus.helpers import asserts, utils, warn
  from quantus.functions.normalise_func import normalise_by_max
  from quantus.helpers.enums import DataType, EvaluationCategory, ModelType, ScoreDirection
  from quantus.helpers.model.model_interface import ModelInterface
label_desc: Use image node_id 11 for calling the Metric obj's underlying member method code with example usage: obj.batch_preprocess(data_batch) and returns: data_batch