class_docstr: Add Gaussian noise to a dataset in one of two ways: either add noise to each sample (keeping the size of the
  original dataset) or perform augmentation by keeping all original samples and adding noisy counterparts. When used
  as part of a :class:`.Classifier` instance, the defense will be applied automatically only when training if
  `augmentation` is true, and only when performing prediction otherwise.
class_docstr_tok: ["Add","Gaussian","noise","to","a","dataset","in","one","of","two","ways",":","either","add","noise","to","each","sample","(","keeping","the","size","of","the","original","dataset",")","or","perform","augmentation","by","keeping","all","original","samples","and","adding","noisy","counterparts",".","When","used","as","part","of","a",":","class",":","`",".Classifier","`","instance",",","the","defense","will","be","applied","automatically","only","when","training","if","`","augmentation","`","is","true",",","and","only","when","performing","prediction","otherwise","."]
docstr: Augment the sample `(x, y)` with Gaussian noise. The result is either an extended dataset containing the
  original sample, as well as the newly created noisy samples (augmentation=True) or just the noisy counterparts
  to the original samples.
  
  :param x: Sample to augment with shape `(batch_size, width, height, depth)`.
  :param y: Labels for the sample. If this argument is provided, it will be augmented with the corresponded
            original labels of each sample point.
  :return: The augmented dataset and (if provided) corresponding labels.
docstr_tok: ["Augment","the","sample","`","(","x",",","y",")","`","with","Gaussian","noise",".","The","result","is","either","an","extended","dataset","containing","the","original","sample",",","as","well","as","the","newly","created","noisy","samples","(","augmentation=True",")","or","just","the","noisy","counterparts","to","the","original","samples",".",":","param","x",":","Sample","to","augment","with","shape","`","(","batch_size",",","width",",","height",",","depth",")","`",".",":","param","y",":","Labels","for","the","sample",".","If","this","argument","is","provided",",","it","will","be","augmented","with","the","corresponded","original","labels","of","each","sample","point",".",":","return",":","The","augmented","dataset","and","(","if","provided",")","corresponding","labels","."]
code: def __call__(
      self, x: np.ndarray, y: Optional[np.ndarray] = None
  ) -> Tuple[np.ndarray, Optional[np.ndarray]]:
      """
      Augment the sample `(x, y)` with Gaussian noise. The result is either an extended dataset containing the
      original sample, as well as the newly created noisy samples (augmentation=True) or just the noisy counterparts
      to the original samples.
  
      :param x: Sample to augment with shape `(batch_size, width, height, depth)`.
      :param y: Labels for the sample. If this argument is provided, it will be augmented with the corresponded
                original labels of each sample point.
      :return: The augmented dataset and (if provided) corresponding labels.
      """
      logger.info("Original dataset size: %d", x.shape[0])
  
      # Select indices to augment
      if self.augmentation:
          size = int(x.shape[0] * self.ratio)
          indices = np.random.randint(0, x.shape[0], size=size)
  
          # Generate noisy samples
          x_aug = np.random.normal(
              x[indices], scale=self.sigma, size=(size,) + x.shape[1:]
          ).astype(ART_NUMPY_DTYPE)
          x_aug = np.vstack((x, x_aug))
          if y is not None:
              y_aug = np.concatenate((y, y[indices]))
          else:
              y_aug = y
          logger.info("Augmented dataset size: %d", x_aug.shape[0])
      else:
          x_aug = np.random.normal(
              x, scale=self.sigma, size=x.shape
          ).astype(ART_NUMPY_DTYPE)
          y_aug = y
          logger.info("Created %i samples with Gaussian noise.")
  
      if self.clip_values is not None:
          x_aug = np.clip(
              x_aug, self.clip_values[0], self.clip_values[1]
          )
  
      return x_aug, y_aug
  
file_path: adversarial-robustness-toolbox/art/defences/preprocessor/gaussian_augmentation.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, Tuple, TYPE_CHECKING
  import numpy
  from art.config import ART_NUMPY_DTYPE
  from art.defences.preprocessor.preprocessor import Preprocessor
label_desc: Use image node_id 2 for calling the GaussianAugmentation obj's underlying member method code with example usage: obj.__call__(x, y) and returns: x_aug,  y_aug