class_docstr: Implementation of the adversarial patch attack for square and rectangular images and videos.
  
  | Paper link: https://arxiv.org/abs/1712.09665
class_docstr_tok: ["Implementation","of","the","adversarial","patch","attack","for","square","and","rectangular","images","and","videos",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1712.09665"]
docstr: A function to apply the learned adversarial patch to images or videos.
  
  :param x: Instances to apply randomly transformed patch.
  :param scale: Scale of the applied patch in relation to the classifier input shape.
  :param patch_external: External patch to apply to images `x`.
  :return: The patched instances.
docstr_tok: ["A","function","to","apply","the","learned","adversarial","patch","to","images","or","videos",".",":","param","x",":","Instances","to","apply","randomly","transformed","patch",".",":","param","scale",":","Scale","of","the","applied","patch","in","relation","to","the","classifier","input","shape",".",":","param","patch_external",":","External","patch","to","apply","to","images","`","x","`",".",":","return",":","The","patched","instances","."]
code: def apply_patch(
      self,
      x: np.ndarray,
      scale: float,
      patch_external: Optional[np.ndarray] = None,
      **kwargs,
  ) -> np.ndarray:
      """
      A function to apply the learned adversarial patch to images or videos.
  
      :param x: Instances to apply randomly transformed patch.
      :param scale: Scale of the applied patch in relation to the classifier input shape.
      :param patch_external: External patch to apply to images `x`.
      :return: The patched instances.
      """
      return self._attack.apply_patch(
          x, scale, patch_external=patch_external, **kwargs
      )
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from art.attacks.evasion.adversarial_patch.adversarial_patch_numpy import AdversarialPatchNumpy
  from art.attacks.evasion.adversarial_patch.adversarial_patch_tensorflow import AdversarialPatchTensorFlowV2
  from art.attacks.evasion.adversarial_patch.adversarial_patch_pytorch import AdversarialPatchPyTorch
  from art.estimators.estimator import BaseEstimator, NeuralNetworkMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.estimators.classification import TensorFlowV2Classifier, PyTorchClassifier
  from art.attacks.attack import EvasionAttack
label_desc: Use image node_id 3 for calling the AdversarialPatch obj's underlying member method code with example usage: obj.apply_patch(x, scale, patch_external) and returns: self