class_docstr: Interface class for the two De-randomized smoothing approaches supported by ART for pytorch.
  
  If a regular pytorch neural network is fed in then (De)Randomized Smoothing as introduced in Levine et al. (2020)
  is used.
  
  Otherwise, if a timm vision transfomer is fed in then Certified Patch Robustness via Smoothed Vision Transformers
  as introduced in Salman et al. (2021) is used.
docstr: Performs cumulative predictions over every ablation location
  
  :param x: Unablated image
  :param batch_size: the batch size for the prediction
  :param training_mode: if to run the classifier in training mode
  :return: cumulative predictions after sweeping over all the ablation configurations.
docstr_tok: ["Performs","cumulative","predictions","over","every","ablation","location",":","param","x",":","Unablated","image",":","param","batch_size",":","the","batch","size","for","the","prediction",":","param","training_mode",":","if","to","run","the","classifier","in","training","mode",":","return",":","cumulative","predictions","after","sweeping","over","all","the","ablation","configurations","."]
code: def predict(
      self,
      x: np.ndarray,
      batch_size: int = 128,
      training_mode: bool = False,
      **kwargs,
  ) -> np.ndarray:
      """
      Performs cumulative predictions over every ablation location
  
      :param x: Unablated image
      :param batch_size: the batch size for the prediction
      :param training_mode: if to run the classifier in training mode
      :return: cumulative predictions after sweeping over all the ablation configurations.
      """
      if self._channels_first:
          columns_in_data = x.shape[-1]
          rows_in_data = x.shape[-2]
      else:
          columns_in_data = x.shape[-2]
          rows_in_data = x.shape[-3]
  
      if self.ablation_type in {"column", "row"}:
          if self.ablation_type == "column":
              ablate_over_range = columns_in_data
          else:
              # image will be transposed, so loop over the number of rows
              ablate_over_range = rows_in_data
  
          for ablation_start in range(ablate_over_range):
              ablated_x = self.ablator.forward(
                  np.copy(x), column_pos=ablation_start
              )
              if ablation_start == 0:
                  preds = self._predict_classifier(
                      ablated_x,
                      batch_size=batch_size,
                      training_mode=training_mode,
                      **kwargs,
                  )
              else:
                  preds += self._predict_classifier(
                      ablated_x,
                      batch_size=batch_size,
                      training_mode=training_mode,
                      **kwargs,
                  )
      elif self.ablation_type == "block":
          for xcorner in range(rows_in_data):
              for ycorner in range(columns_in_data):
                  ablated_x = self.ablator.forward(
                      np.copy(x), row_pos=xcorner, column_pos=ycorner
                  )
                  if ycorner == 0 and xcorner == 0:
                      preds = self._predict_classifier(
                          ablated_x,
                          batch_size=batch_size,
                          training_mode=training_mode,
                          **kwargs,
                      )
                  else:
                      preds += self._predict_classifier(
                          ablated_x,
                          batch_size=batch_size,
                          training_mode=training_mode,
                          **kwargs,
                      )
  
      return preds
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import importlib
  import logging
  from typing import List, Optional, Tuple, Union, Any, TYPE_CHECKING
  import random
  import numpy
  from tqdm import tqdm
  from art.estimators.classification.pytorch import PyTorchClassifier
  from art.estimators.certification.derandomized_smoothing.derandomized import DeRandomizedSmoothingMixin
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 9 for calling the PyTorchDeRandomizedSmoothing obj's underlying member method code with example usage: obj.predict(x, batch_size, training_mode) and returns: preds