class_docstr: This is a modified version of the L_2 optimized attack of Carlini and Wagner (2016). It controls the L_Inf
  norm, i.e. the maximum perturbation applied to each pixel.
docstr: Generate a single adversarial example.
  
  :param x_batch: Current benign sample.
  :param y_batch: Current label.
  :param clip_min: Minimum clipping values.
  :param clip_max: Maximum clipping values.
  :param  const: Current constant `c`.
  :param tau: Current limit `tau`.
docstr_tok: ["Generate","a","single","adversarial","example",".",":","param","x_batch",":","Current","benign","sample",".",":","param","y_batch",":","Current","label",".",":","param","clip_min",":","Minimum","clipping","values",".",":","param","clip_max",":","Maximum","clipping","values",".",":","param","const",":","Current","constant","`","c","`",".",":","param","tau",":","Current","limit","`","tau","`","."]
code: def _generate_single(
      self, x_batch, y_batch, clip_min, clip_max, const, tau
  ):
      """
      Generate a single adversarial example.
  
      :param x_batch: Current benign sample.
      :param y_batch: Current label.
      :param clip_min: Minimum clipping values.
      :param clip_max: Maximum clipping values.
      :param  const: Current constant `c`.
      :param tau: Current limit `tau`.
      """
  
      # The optimization is performed in tanh space to keep the adversarial images bounded from clip_min and clip_max.
      x_adv_batch_tanh = original_to_tanh(
          x_batch, clip_min, clip_max, self._tanh_smoother
      )
  
      def func(x_i):
          x_adv_batch_tanh = x_i
  
          x_adv_batch = tanh_to_original(
              x_adv_batch_tanh,
              clip_min,
              clip_max,
          )
  
          _, loss, _, _ = self._loss(
              x_adv_batch, y_batch, x_batch, const, tau
          )
  
          return loss
  
      def func_der(x_i):
          x_adv_batch_tanh = x_i
  
          x_adv_batch = tanh_to_original(
              x_adv_batch_tanh,
              clip_min,
              clip_max,
          )
  
          z_logits, _, _, _ = self._loss(
              x_adv_batch, y_batch, x_batch, const, tau
          )
  
          perturbation_tanh = self._loss_gradient(
              z_logits,
              y_batch,
              x_adv_batch,
              x_adv_batch_tanh,
              clip_min,
              clip_max,
              x_batch,
              tau,
          )
  
          return perturbation_tanh
  
      x_0 = x_adv_batch_tanh.copy()
  
      adam = Adam(
          alpha=self.learning_rate,
          beta_1=0.9,
          beta_2=0.999,
          epsilon=1e-8,
      )
      x_adv_batch_tanh = adam.optimize(
          func=func,
          jac=func_der,
          x_0=x_0,
          max_iter=self.max_iter,
          loss_converged=0.001,
      )
  
      x_adv_batch = tanh_to_original(
          x_adv_batch_tanh,
          clip_min,
          clip_max,
      )
  
      return x_adv_batch
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, Tuple, TYPE_CHECKING
  import numpy
  from tqdm.auto import trange
  from art.config import ART_NUMPY_DTYPE
  from art.optimizers import Adam
  from art.estimators.estimator import BaseEstimator
  from art.estimators.classification.classifier import ClassGradientsMixin
  from art.attacks.attack import EvasionAttack
  from art.utils import compute_success, get_labels_np_array, tanh_to_original, original_to_tanh
  from art.utils import check_and_transform_label_format
label_desc: Use image node_id 4 for calling the CarliniLInfMethod obj's underlying member method code with example usage: obj._generate_single(x_batch, y_batch, clip_min, clip_max, const, tau) and returns: x_adv_batch, loss, perturbation_tanh