class_docstr: Class performing adversarial training following Oracle Aligned Adversarial Training (OAAT) protocol.
  
  | Paper link: https://link.springer.com/chapter/10.1007/978-3-031-20065-6_18
class_docstr_tok: ["Class","performing","adversarial","training","following","Oracle","Aligned","Adversarial","Training","(","OAAT",")","protocol",".","|","Paper","link",":","https",":","\/\/link.springer.com\/chapter\/10.1007\/978-3-031-20065-6_18"]
docstr: Apply perturbation on examples.
  
  :param x: Current adversarial examples.
  :param perturbation: Current perturbations.
  :param eps_step: Attack step size (input variation) at each iteration.
  :return: Adversarial examples.
docstr_tok: ["Apply","perturbation","on","examples",".",":","param","x",":","Current","adversarial","examples",".",":","param","perturbation",":","Current","perturbations",".",":","param","eps_step",":","Attack","step","size","(","input","variation",")","at","each","iteration",".",":","return",":","Adversarial","examples","."]
code: def _apply_perturbation(
      self,
      x: "torch.Tensor",
      perturbation: "torch.Tensor",
      eps_step: Union[int, float, np.ndarray],
  ) -> "torch.Tensor":
      """
      Apply perturbation on examples.
  
      :param x: Current adversarial examples.
      :param perturbation: Current perturbations.
      :param eps_step: Attack step size (input variation) at each iteration.
      :return: Adversarial examples.
      """
      import torch
  
      eps_step = np.array(eps_step, dtype=ART_NUMPY_DTYPE)
      perturbation_step = (
          torch.tensor(eps_step).to(self._classifier.device)
          * perturbation
      )
      perturbation_step[torch.isnan(perturbation_step)] = 0
      x = x + perturbation_step
      if self._classifier.clip_values is not None:
          clip_min, clip_max = self._classifier.clip_values
          x = torch.max(
              torch.min(
                  x, torch.tensor(clip_max).to(self._classifier.device)
              ),
              torch.tensor(clip_min).to(self._classifier.device),
          )
  
      return x
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from collections import OrderedDict
  import logging
  import os
  import time
  from typing import Optional, Tuple, TYPE_CHECKING, List, Dict, Union
  import six
  import numpy
  from tqdm.auto import trange
  from art import config
  from art.defences.trainer.adversarial_trainer_oaat import AdversarialTrainerOAAT
  from art.estimators.classification.pytorch import PyTorchClassifier
  from art.data_generators import DataGenerator
  from art.attacks.attack import EvasionAttack
  from art.utils import check_and_transform_label_format, random_sphere
  from art.config import ART_NUMPY_DTYPE
label_desc: Use image node_id 15 for calling the AdversarialTrainerOAATPyTorch obj's underlying member method code with example usage: obj._apply_perturbation(x, perturbation, eps_step) and returns: x