code: def perturb_batch(
      perturb_func: Callable,
      arr: np.ndarray,
      indices: Optional[np.ndarray] = None,
      inplace: bool = False,
      **kwargs,
  ) -> Union[np.ndarray, None]:
      """
      Use a perturb function and make perturbation on the full batch.
  
      Parameters
      ----------
      perturb_func: callable
          Input perturbation function.
       arr: np.ndarray
           Array to be perturbed.
      indices: int, sequence, tuple
          Array-like, with a subset shape of arr.
      inplace: boolean
          Indicates if the array should be copied or not.
      kwargs: optional
          Keyword arguments.
  
      Returns
      -------
      None, array
      """
      if indices is not None:
          assert arr.shape[0] == len(
              indices
          ), "arr and indices need same number of batches"
  
      if not inplace:
          arr = arr.copy()
  
      # Run perturbation.
      for i in range(len(arr)):
          if indices is not None:
              arr[i] = perturb_func(
                  arr=arr[i], indices=indices[i][1:], **kwargs
              )
          else:
              arr[i] = perturb_func(arr=arr[i], **kwargs)
  
      if not inplace:
          return arr
  
      return None
  
file_path: Quantus/quantus/functions/perturb_func.py
imports: import copy
  import random
  import warnings
  from typing import Any, Callable, Sequence, Tuple, Union, Optional
  import cv2
  import numpy
  from scipy.sparse import lil_matrix, csc_matrix
  from scipy.sparse.linalg import spsolve
  from quantus.helpers.utils import get_baseline_value, blur_at_indices, expand_indices, get_leftover_shape, offset_coordinates
label_desc: Use image node_id 1 for calling a global function with example usage: perturb_batch(perturb_func, arr, indices, inplace) and returns: None, arr