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: Compute the gradient of the loss function.
  
  :param z_logits: An array with the current predictions.
  :param target: An array with the target class (one-hot encoded).
  :param x_adv: An array with the adversarial input.
  :param x_adv_tanh: An array with the adversarial input in tanh space.
  :param clip_min: Minimum clipping values.
  :param clip_max: Maximum clipping values.
  :param x: Benign samples.
  :param tau: Current limit `tau`.
  :return: An array with the gradient of the loss function.
docstr_tok: ["Compute","the","gradient","of","the","loss","function",".",":","param","z_logits",":","An","array","with","the","current","predictions",".",":","param","target",":","An","array","with","the","target","class","(","one-hot","encoded",")",".",":","param","x_adv",":","An","array","with","the","adversarial","input",".",":","param","x_adv_tanh",":","An","array","with","the","adversarial","input","in","tanh","space",".",":","param","clip_min",":","Minimum","clipping","values",".",":","param","clip_max",":","Maximum","clipping","values",".",":","param","x",":","Benign","samples",".",":","param","tau",":","Current","limit","`","tau","`",".",":","return",":","An","array","with","the","gradient","of","the","loss","function","."]
code: def _loss_gradient(
      self,
      z_logits: np.ndarray,
      target: np.ndarray,
      x_adv: np.ndarray,
      x_adv_tanh: np.ndarray,
      clip_min: np.ndarray,
      clip_max: np.ndarray,
      x,
      tau,
  ) -> np.ndarray:
      """
      Compute the gradient of the loss function.
  
      :param z_logits: An array with the current predictions.
      :param target: An array with the target class (one-hot encoded).
      :param x_adv: An array with the adversarial input.
      :param x_adv_tanh: An array with the adversarial input in tanh space.
      :param clip_min: Minimum clipping values.
      :param clip_max: Maximum clipping values.
      :param x: Benign samples.
      :param tau: Current limit `tau`.
      :return: An array with the gradient of the loss function.
      """
      if self.targeted:
          i_sub = np.argmax(target, axis=1)
          i_add = np.argmax(
              z_logits * (1 - target)
              + (np.min(z_logits, axis=1) - 1)[:, np.newaxis] * target,
              axis=1,
          )
      else:
          i_add = np.argmax(target, axis=1)
          i_sub = np.argmax(
              z_logits * (1 - target)
              + (np.min(z_logits, axis=1) - 1)[:, np.newaxis] * target,
              axis=1,
          )
  
      loss_gradient = self.estimator.class_gradient(x_adv, label=i_add)
      loss_gradient -= self.estimator.class_gradient(x_adv, label=i_sub)
      loss_gradient = loss_gradient.reshape(x_adv.shape)
  
      loss_gradient_2 = np.sign(
          np.maximum(0.0, np.abs(x_adv - x) - tau)
      ) * np.sign(x_adv - x)
      loss_gradient_2 *= clip_max - clip_min
      loss_gradient_2 *= (1 - np.square(np.tanh(x_adv_tanh))) / (
          2 * self._tanh_smoother
      )
  
      loss_gradient *= clip_max - clip_min
      loss_gradient *= (1 - np.square(np.tanh(x_adv_tanh))) / (
          2 * self._tanh_smoother
      )
  
      loss_gradient = loss_gradient + loss_gradient_2
  
      return loss_gradient
  
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 3 for calling the CarliniLInfMethod obj's underlying member method code with example usage: obj._loss_gradient(z_logits, target, x_adv, x_adv_tanh, clip_min, clip_max, x, tau) and returns: loss_gradient