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: Get the mask from the kwargs.
  
  :param x: An array with the original inputs.
  :param mask: An array with a mask to be applied to the adversarial perturbations. Shape needs to be
               broadcastable to the shape of x. Any features for which the mask is zero will not be adversarially
               perturbed.
  :type mask: `np.ndarray`
  :return: The mask.
docstr_tok: ["Get","the","mask","from","the","kwargs",".",":","param","x",":","An","array","with","the","original","inputs",".",":","param","mask",":","An","array","with","a","mask","to","be","applied","to","the","adversarial","perturbations",".","Shape","needs","to","be","broadcastable","to","the","shape","of","x",".","Any","features","for","which","the","mask","is","zero","will","not","be","adversarially","perturbed",".",":","type","mask",":","`","np.ndarray","`",":","return",":","The","mask","."]
code: def _get_mask(x: np.ndarray, **kwargs) -> np.ndarray:
      """
      Get the mask from the kwargs.
  
      :param x: An array with the original inputs.
      :param mask: An array with a mask to be applied to the adversarial perturbations. Shape needs to be
                   broadcastable to the shape of x. Any features for which the mask is zero will not be adversarially
                   perturbed.
      :type mask: `np.ndarray`
      :return: The mask.
      """
      mask = kwargs.get("mask")
  
      if mask is not None:
          if mask.ndim > x.ndim:  # pragma: no cover
              raise ValueError(
                  "Mask shape must be broadcastable to input shape."
              )
  
          if not (
              np.issubdtype(mask.dtype, np.floating)
              or mask.dtype == bool
          ):  # pragma: no cover
              raise ValueError(
                  f"The `mask` has to be either of type np.float32, np.float64 or bool. The provided"
                  f"`mask` is of type {mask.dtype}."
              )
  
          if (
              np.issubdtype(mask.dtype, np.floating)
              and np.amin(mask) < 0.0
          ):  # pragma: no cover
              raise ValueError(
                  "The `mask` of type np.float32 or np.float64 requires all elements to be either zero"
                  "or positive values."
              )
  
      return mask
  
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 9 for calling the FastGradientMethod obj's underlying member method code with example usage: obj._get_mask(x) and returns: mask