class_docstr: Implementation of Randomized Smoothing applied to classifier predictions and gradients, as introduced
  in Cohen et al. (2019).
  
  | Paper link: https://arxiv.org/abs/1902.02918
class_docstr_tok: ["Implementation","of","Randomized","Smoothing","applied","to","classifier","predictions","and","gradients",",","as","introduced","in","Cohen","et","al",".","(","2019",")",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1902.02918"]
docstr: Adds Gaussian noise to `x` to generate samples. Optionally augments `y` similarly.
  
  :param x: Sample input with shape as expected by the model.
  :param n: Number of noisy samples to create.
  :return: Array of samples of the same shape as `x`.
docstr_tok: ["Adds","Gaussian","noise","to","`","x","`","to","generate","samples",".","Optionally","augments","`","y","`","similarly",".",":","param","x",":","Sample","input","with","shape","as","expected","by","the","model",".",":","param","n",":","Number","of","noisy","samples","to","create",".",":","return",":","Array","of","samples","of","the","same","shape","as","`","x","`","."]
code: def _noisy_samples(
      self, x: np.ndarray, n: Optional[int] = None
  ) -> np.ndarray:
      """
      Adds Gaussian noise to `x` to generate samples. Optionally augments `y` similarly.
  
      :param x: Sample input with shape as expected by the model.
      :param n: Number of noisy samples to create.
      :return: Array of samples of the same shape as `x`.
      """
      # set default value to sample_size
      if n is None:
          n = self.sample_size
  
      # augment x
      x = np.expand_dims(x, axis=0)
      x = np.repeat(x, n, axis=0)
      x = x + np.random.normal(scale=self.scale, size=x.shape).astype(
          ART_NUMPY_DTYPE
      )
  
      return x
  
file_path: adversarial-robustness-toolbox/art/estimators/certification/randomized_smoothing/randomized_smoothing.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from abc import ABC
  import logging
  from typing import Optional, Tuple
  import numpy
  from scipy.stats import norm
  from tqdm.auto import tqdm
  from art.config import ART_NUMPY_DTYPE
label_desc: Use image node_id 7 for calling the RandomizedSmoothingMixin obj's underlying member method code with example usage: obj._noisy_samples(x, n) and returns: x