class_docstr: Class performing adversarial training following the DP-InstaHide protocol.
  
  Uses data augmentation methods in conjunction with some type of additive noise.
  
  | Paper link: https://arxiv.org/abs/2103.02079
class_docstr_tok: ["Class","performing","adversarial","training","following","the","DP-InstaHide","protocol",".","Uses","data","augmentation","methods","in","conjunction","with","some","type","of","additive","noise",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/2103.02079"]
code: def _generate_noise(self, x: np.ndarray) -> np.ndarray:
      if self.noise == "gaussian":
          noise = np.random.normal(
              loc=self.loc, scale=self.scale, size=x.shape
          )
      elif self.noise == "laplacian":
          noise = np.random.laplace(
              loc=self.loc, scale=self.scale, size=x.shape
          )
      elif self.noise == "exponential":
          noise = np.random.exponential(scale=self.scale, size=x.shape)
      else:
          raise ValueError(
              "The provided noise type is not supported:", self.noise
          )
  
      x_noise = x + noise
      x_noise = np.clip(
          x_noise, self.clip_values[0], self.clip_values[1]
      )
  
      return x_noise.astype(x.dtype)
  
file_path: adversarial-robustness-toolbox/art/defences/trainer/dp_instahide_trainer.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import sys
  import time
  from typing import List, Optional, Union, Tuple, TYPE_CHECKING
  import numpy
  from tqdm.auto import trange
  from art.defences.trainer.trainer import Trainer
label_desc: Use image node_id 2 for calling the DPInstaHideTrainer obj's underlying member method code with example usage: obj._generate_noise(x) and returns: x_noise