class_docstr: This attack was originally implemented by Goodfellow et al. (2015) with the infinity norm (and is known as the "Fast
  Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast
  Gradient Method.
  
  | Paper link: https://arxiv.org/abs/1412.6572
class_docstr_tok: ["This","attack","was","originally","implemented","by","Goodfellow","et","al",".","(","2015",")","with","the","infinity","norm","(","and","is","known","as","the","``","Fast","Gradient","Sign","Method","''",")",".","This","implementation","extends","the","attack","to","other","norms",",","and","is","therefore","called","the","Fast","Gradient","Method",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1412.6572"]
code: def _apply_perturbation(
      self,
      x: np.ndarray,
      perturbation: np.ndarray,
      eps_step: Union[int, float, np.ndarray],
  ) -> np.ndarray:
      perturbation_step = eps_step * perturbation
      if perturbation_step.dtype != object:
          perturbation_step[np.isnan(perturbation_step)] = 0
      else:
          for i, _ in enumerate(perturbation_step):
              perturbation_step_i_array = perturbation_step[i].astype(
                  np.float32
              )
              if np.isnan(perturbation_step_i_array).any():
                  perturbation_step[i] = np.where(
                      np.isnan(perturbation_step_i_array),
                      0.0,
                      perturbation_step_i_array,
                  ).astype(object)
  
      x = x + perturbation_step
      if self.estimator.clip_values is not None:
          clip_min, clip_max = self.estimator.clip_values
          if x.dtype == object:
              for i_obj in range(x.shape[0]):
                  x[i_obj] = np.clip(x[i_obj], clip_min, clip_max)
          else:
              x = np.clip(x, clip_min, clip_max)
  
      return x
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, Union, TYPE_CHECKING
  import numpy
  from art.config import ART_NUMPY_DTYPE
  from art.attacks.attack import EvasionAttack
  from art.estimators.estimator import BaseEstimator, LossGradientsMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.utils import compute_success, get_labels_np_array, random_sphere, projection, check_and_transform_label_format
  from art.summary_writer import SummaryWriter
label_desc: Use image node_id 7 for calling the FastGradientMethod obj's underlying member method code with example usage: obj._apply_perturbation(x, perturbation, eps_step) and returns: x