class_docstr: Implements ``Wasserstein Adversarial Examples via Projected Sinkhorn Iterations`` as evasion attack.
  
  | Paper link: https://arxiv.org/abs/1902.07906
class_docstr_tok: ["Implements","``","Wasserstein","Adversarial","Examples","via","Projected","Sinkhorn","Iterations","``","as","evasion","attack",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1902.07906"]
docstr: Create a Wasserstein attack instance.
  
  :param estimator: A trained estimator.
  :param targeted: Indicates whether the attack is targeted (True) or untargeted (False).
  :param regularization: Entropy regularization.
  :param p: The p-wasserstein distance.
  :param kernel_size: Kernel size for computing the cost matrix.
  :param eps_step: Attack step size (input variation) at each iteration.
  :param norm: The norm of the adversarial perturbation. Possible values: `inf`, `1`, `2` or `wasserstein`.
  :param ball: The ball of the adversarial perturbation. Possible values: `inf`, `1`, `2` or `wasserstein`.
  :param eps: Maximum perturbation that the attacker can introduce.
  :param eps_iter: Number of iterations to increase the epsilon.
  :param eps_factor: Factor to increase the epsilon.
  :param max_iter: The maximum number of iterations.
  :param conjugate_sinkhorn_max_iter: The maximum number of iterations for the conjugate sinkhorn optimizer.
  :param projected_sinkhorn_max_iter: The maximum number of iterations for the projected sinkhorn optimizer.
  :param batch_size: Size of batches.
  :param verbose: Show progress bars.
docstr_tok: ["Create","a","Wasserstein","attack","instance",".",":","param","estimator",":","A","trained","estimator",".",":","param","targeted",":","Indicates","whether","the","attack","is","targeted","(","True",")","or","untargeted","(","False",")",".",":","param","regularization",":","Entropy","regularization",".",":","param","p",":","The","p-wasserstein","distance",".",":","param","kernel_size",":","Kernel","size","for","computing","the","cost","matrix",".",":","param","eps_step",":","Attack","step","size","(","input","variation",")","at","each","iteration",".",":","param","norm",":","The","norm","of","the","adversarial","perturbation",".","Possible","values",":","`","inf","`",",","`","1","`",",","`","2","`","or","`","wasserstein","`",".",":","param","ball",":","The","ball","of","the","adversarial","perturbation",".","Possible","values",":","`","inf","`",",","`","1","`",",","`","2","`","or","`","wasserstein","`",".",":","param","eps",":","Maximum","perturbation","that","the","attacker","can","introduce",".",":","param","eps_iter",":","Number","of","iterations","to","increase","the","epsilon",".",":","param","eps_factor",":","Factor","to","increase","the","epsilon",".",":","param","max_iter",":","The","maximum","number","of","iterations",".",":","param","conjugate_sinkhorn_max_iter",":","The","maximum","number","of","iterations","for","the","conjugate","sinkhorn","optimizer",".",":","param","projected_sinkhorn_max_iter",":","The","maximum","number","of","iterations","for","the","projected","sinkhorn","optimizer",".",":","param","batch_size",":","Size","of","batches",".",":","param","verbose",":","Show","progress","bars","."]
code: def __init__(
      self,
      estimator: "CLASSIFIER_LOSS_GRADIENTS_TYPE",
      targeted: bool = False,
      regularization: float = 3000.0,
      p: int = 2,
      kernel_size: int = 5,
      eps_step: float = 0.1,
      norm: str = "wasserstein",
      ball: str = "wasserstein",
      eps: float = 0.3,
      eps_iter: int = 10,
      eps_factor: float = 1.1,
      max_iter: int = 400,
      conjugate_sinkhorn_max_iter: int = 400,
      projected_sinkhorn_max_iter: int = 400,
      batch_size: int = 1,
      verbose: bool = True,
  ):
      """
      Create a Wasserstein attack instance.
  
      :param estimator: A trained estimator.
      :param targeted: Indicates whether the attack is targeted (True) or untargeted (False).
      :param regularization: Entropy regularization.
      :param p: The p-wasserstein distance.
      :param kernel_size: Kernel size for computing the cost matrix.
      :param eps_step: Attack step size (input variation) at each iteration.
      :param norm: The norm of the adversarial perturbation. Possible values: `inf`, `1`, `2` or `wasserstein`.
      :param ball: The ball of the adversarial perturbation. Possible values: `inf`, `1`, `2` or `wasserstein`.
      :param eps: Maximum perturbation that the attacker can introduce.
      :param eps_iter: Number of iterations to increase the epsilon.
      :param eps_factor: Factor to increase the epsilon.
      :param max_iter: The maximum number of iterations.
      :param conjugate_sinkhorn_max_iter: The maximum number of iterations for the conjugate sinkhorn optimizer.
      :param projected_sinkhorn_max_iter: The maximum number of iterations for the projected sinkhorn optimizer.
      :param batch_size: Size of batches.
      :param verbose: Show progress bars.
      """
      super().__init__(estimator=estimator)
  
      self._targeted = targeted
      self.regularization = regularization
      self.p = p  # pylint: disable=C0103
      self.kernel_size = kernel_size
      self.eps_step = eps_step
      self.norm = norm
      self.ball = ball
      self.eps = eps
      self.eps_iter = eps_iter
      self.eps_factor = eps_factor
      self.max_iter = max_iter
      self.conjugate_sinkhorn_max_iter = conjugate_sinkhorn_max_iter
      self.projected_sinkhorn_max_iter = projected_sinkhorn_max_iter
      self.batch_size = batch_size
      self.verbose = verbose
      self._check_params()
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, TYPE_CHECKING
  import numpy
  from scipy.special import lambertw
  from tqdm.auto import trange
  from art.config import ART_NUMPY_DTYPE
  from art.estimators.estimator import BaseEstimator, LossGradientsMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.attacks.attack import EvasionAttack
  from art.utils import get_labels_np_array, check_and_transform_label_format
label_desc: Use image node_id 1 to create a new Wasserstein object from inherited base classes: EvasionAttack with example: obj = Wasserstein(estimator, targeted, regularization, p, kernel_size, eps_step, norm, ball, eps, eps_iter, eps_factor, max_iter, conjugate_sinkhorn_max_iter, projected_sinkhorn_max_iter, batch_size, verbose)