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"]
docstr: Create a :class:`.FastGradientMethod` instance.
  
  :param estimator: A trained classifier.
  :param norm: The norm of the adversarial perturbation. Possible values: "inf", np.inf, 1 or 2.
  :param eps: Attack step size (input variation).
  :param eps_step: Step size of input variation for minimal perturbation computation.
  :param targeted: Indicates whether the attack is targeted (True) or untargeted (False)
  :param num_random_init: Number of random initialisations within the epsilon ball. For random_init=0 starting at
      the original input.
  :param batch_size: Size of the batch on which adversarial samples are generated.
  :param minimal: Indicates if computing the minimal perturbation (True). If True, also define `eps_step` for
                  the step size and eps for the maximum perturbation.
  :param summary_writer: Activate summary writer for TensorBoard.
                         Default is `False` and deactivated summary writer.
                         If `True` save runs/CURRENT_DATETIME_HOSTNAME in current directory.
                         If of type `str` save in path.
                         If of type `SummaryWriter` apply provided custom summary writer.
                         Use hierarchical folder structure to compare between runs easily. e.g. pass in
                         ‘runs/exp1’, ‘runs/exp2’, etc. for each new experiment to compare across them.
docstr_tok: ["Create","a",":","class",":","`",".FastGradientMethod","`","instance",".",":","param","estimator",":","A","trained","classifier",".",":","param","norm",":","The","norm","of","the","adversarial","perturbation",".","Possible","values",":","``","inf","''",",","np.inf",",","1","or","2.",":","param","eps",":","Attack","step","size","(","input","variation",")",".",":","param","eps_step",":","Step","size","of","input","variation","for","minimal","perturbation","computation",".",":","param","targeted",":","Indicates","whether","the","attack","is","targeted","(","True",")","or","untargeted","(","False",")",":","param","num_random_init",":","Number","of","random","initialisations","within","the","epsilon","ball",".","For","random_init=0","starting","at","the","original","input",".",":","param","batch_size",":","Size","of","the","batch","on","which","adversarial","samples","are","generated",".",":","param","minimal",":","Indicates","if","computing","the","minimal","perturbation","(","True",")",".","If","True",",","also","define","`","eps_step","`","for","the","step","size","and","eps","for","the","maximum","perturbation",".",":","param","summary_writer",":","Activate","summary","writer","for","TensorBoard",".","Default","is","`","False","`","and","deactivated","summary","writer",".","If","`","True","`","save","runs\/CURRENT_DATETIME_HOSTNAME","in","current","directory",".","If","of","type","`","str","`","save","in","path",".","If","of","type","`","SummaryWriter","`","apply","provided","custom","summary","writer",".","Use","hierarchical","folder","structure","to","compare","between","runs","easily",".","e.g",".","pass","in","\u2018","runs\/exp1","\u2019",",","\u2018","runs\/exp2","\u2019",",","etc",".","for","each","new","experiment","to","compare","across","them","."]
code: def __init__(
      self,
      estimator: "CLASSIFIER_LOSS_GRADIENTS_TYPE",
      norm: Union[int, float, str] = np.inf,
      eps: Union[int, float, np.ndarray] = 0.3,
      eps_step: Union[int, float, np.ndarray] = 0.1,
      targeted: bool = False,
      num_random_init: int = 0,
      batch_size: int = 32,
      minimal: bool = False,
      summary_writer: Union[str, bool, SummaryWriter] = False,
  ) -> None:
      """
      Create a :class:`.FastGradientMethod` instance.
  
      :param estimator: A trained classifier.
      :param norm: The norm of the adversarial perturbation. Possible values: "inf", np.inf, 1 or 2.
      :param eps: Attack step size (input variation).
      :param eps_step: Step size of input variation for minimal perturbation computation.
      :param targeted: Indicates whether the attack is targeted (True) or untargeted (False)
      :param num_random_init: Number of random initialisations within the epsilon ball. For random_init=0 starting at
          the original input.
      :param batch_size: Size of the batch on which adversarial samples are generated.
      :param minimal: Indicates if computing the minimal perturbation (True). If True, also define `eps_step` for
                      the step size and eps for the maximum perturbation.
      :param summary_writer: Activate summary writer for TensorBoard.
                             Default is `False` and deactivated summary writer.
                             If `True` save runs/CURRENT_DATETIME_HOSTNAME in current directory.
                             If of type `str` save in path.
                             If of type `SummaryWriter` apply provided custom summary writer.
                             Use hierarchical folder structure to compare between runs easily. e.g. pass in
                             ‘runs/exp1’, ‘runs/exp2’, etc. for each new experiment to compare across them.
      """
      super().__init__(
          estimator=estimator, summary_writer=summary_writer
      )
      self.norm = norm
      self.eps = eps
      self.eps_step = eps_step
      self._targeted = targeted
      self.num_random_init = num_random_init
      self.batch_size = batch_size
      self.minimal = minimal
      self._project = True
      FastGradientMethod._check_params(self)
  
      self._batch_id = 0
      self._i_max_iter = 0
  
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 1 to create a new FastGradientMethod object from inherited base classes: EvasionAttack with example: obj = FastGradientMethod(estimator, norm, eps, eps_step, targeted, num_random_init, batch_size, minimal, summary_writer)