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: Method to update the batchnorm of a neural network on small datasets when it was pre-trained
  
  :param x: Training data.
  :param batch_size: Size of batches.
  :param nb_epochs: How many times to forward pass over the input data
docstr_tok: ["Method","to","update","the","batchnorm","of","a","neural","network","on","small","datasets","when","it","was","pre-trained",":","param","x",":","Training","data",".",":","param","batch_size",":","Size","of","batches",".",":","param","nb_epochs",":","How","many","times","to","forward","pass","over","the","input","data"]
code: def update_batchnorm(
      self, x: np.ndarray, batch_size: int, nb_epochs: int = 1
  ) -> None:
      """
      Method to update the batchnorm of a neural network on small datasets when it was pre-trained
  
      :param x: Training data.
      :param batch_size: Size of batches.
      :param nb_epochs: How many times to forward pass over the input data
      """
      import torch
  
      if self.mode != "ViT":
          raise ValueError(
              "Accessing a ViT specific functionality while running in CNN mode"
          )
  
      self.model.train()
  
      ind = np.arange(len(x))
      num_batch = int(len(x) / float(batch_size))
  
      with torch.no_grad():
          for _ in tqdm(range(nb_epochs)):
              for m in tqdm(range(num_batch)):
                  i_batch = self.ablator.forward(
                      np.copy(
                          x[ind[m * batch_size : (m + 1) * batch_size]]
                      ),
                      column_pos=random.randint(0, x.shape[3]),
                  )
                  _ = self.model(i_batch)
  
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 6 for calling the PyTorchDeRandomizedSmoothing obj's underlying member method code with example usage: obj.update_batchnorm(x, batch_size, nb_epochs) without return types