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: Compute adversarial examples for one iteration.
  
  :param x_adv: Current adversarial examples.
  :param x_init: An array with the original inputs.
  :param y: Target values (class labels) one-hot-encoded of shape `(nb_samples, nb_classes)` or indices of shape
            (nb_samples,). Only provide this parameter if you'd like to use true labels when crafting adversarial
            samples. Otherwise, model predictions are used as labels to avoid the "label leaking" effect
            (explained in this paper: https://arxiv.org/abs/1611.01236). Default is `None`.
  :param cost_matrix: A non-negative cost matrix.
  :param eps: Maximum perturbation that the attacker can introduce.
  :param err: Current successful adversarial examples.
  :return: Adversarial examples.
docstr_tok: ["Compute","adversarial","examples","for","one","iteration",".",":","param","x_adv",":","Current","adversarial","examples",".",":","param","x_init",":","An","array","with","the","original","inputs",".",":","param","y",":","Target","values","(","class","labels",")","one-hot-encoded","of","shape","`","(","nb_samples",",","nb_classes",")","`","or","indices","of","shape","(","nb_samples",",",")",".","Only","provide","this","parameter","if","you","'d","like","to","use","true","labels","when","crafting","adversarial","samples",".","Otherwise",",","model","predictions","are","used","as","labels","to","avoid","the","``","label","leaking","''","effect","(","explained","in","this","paper",":","https",":","\/\/arxiv.org\/abs\/1611.01236",")",".","Default","is","`","None","`",".",":","param","cost_matrix",":","A","non-negative","cost","matrix",".",":","param","eps",":","Maximum","perturbation","that","the","attacker","can","introduce",".",":","param","err",":","Current","successful","adversarial","examples",".",":","return",":","Adversarial","examples","."]
code: def _compute(
      self,
      x_adv: np.ndarray,
      x_init: np.ndarray,
      y: np.ndarray,
      cost_matrix: np.ndarray,
      eps: np.ndarray,
      err: np.ndarray,
  ) -> np.ndarray:
      """
      Compute adversarial examples for one iteration.
  
      :param x_adv: Current adversarial examples.
      :param x_init: An array with the original inputs.
      :param y: Target values (class labels) one-hot-encoded of shape `(nb_samples, nb_classes)` or indices of shape
                (nb_samples,). Only provide this parameter if you'd like to use true labels when crafting adversarial
                samples. Otherwise, model predictions are used as labels to avoid the "label leaking" effect
                (explained in this paper: https://arxiv.org/abs/1611.01236). Default is `None`.
      :param cost_matrix: A non-negative cost matrix.
      :param eps: Maximum perturbation that the attacker can introduce.
      :param err: Current successful adversarial examples.
      :return: Adversarial examples.
      """
      # Compute and apply perturbation
      x_adv[~err] = self._compute_apply_perturbation(
          x_adv, y, cost_matrix
      )[~err]
  
      # Do projection
      x_adv[~err] = self._apply_projection(
          x_adv, x_init, cost_matrix, eps
      )[~err]
  
      # Clip x_adv
      if self.estimator.clip_values is not None:
          clip_min, clip_max = self.estimator.clip_values
          x_adv = np.clip(x_adv, clip_min, clip_max)
  
      return x_adv
  
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 4 for calling the Wasserstein obj's underlying member method code with example usage: obj._compute(x_adv, x_init, y, cost_matrix, eps, err) and returns: x_adv