class_docstr: The black-box zeroth-order optimization attack from Pin-Yu Chen et al. (2018). This attack is a variant of the
  C&W attack which uses ADAM coordinate descent to perform numerical estimation of gradients.
  
  | Paper link: https://arxiv.org/abs/1708.03999
class_docstr_tok: ["The","black-box","zeroth-order","optimization","attack","from","Pin-Yu","Chen","et","al",".","(","2018",")",".","This","attack","is","a","variant","of","the","C","&","W","attack","which","uses","ADAM","coordinate","descent","to","perform","numerical","estimation","of","gradients",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1708.03999"]
docstr: Compute the loss function values.
  
  :param x: An array with the original input.
  :param x_adv: An array with the adversarial input.
  :param target: An array with the target class (one-hot encoded).
  :param c_weight: Weight of the loss term aiming for classification as target.
  :return: A tuple holding the current logits, `L_2` distortion and overall loss.
docstr_tok: ["Compute","the","loss","function","values",".",":","param","x",":","An","array","with","the","original","input",".",":","param","x_adv",":","An","array","with","the","adversarial","input",".",":","param","target",":","An","array","with","the","target","class","(","one-hot","encoded",")",".",":","param","c_weight",":","Weight","of","the","loss","term","aiming","for","classification","as","target",".",":","return",":","A","tuple","holding","the","current","logits",",","`","L_2","`","distortion","and","overall","loss","."]
code: def _loss(
      self,
      x: np.ndarray,
      x_adv: np.ndarray,
      target: np.ndarray,
      c_weight: np.ndarray,
  ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
      """
      Compute the loss function values.
  
      :param x: An array with the original input.
      :param x_adv: An array with the adversarial input.
      :param target: An array with the target class (one-hot encoded).
      :param c_weight: Weight of the loss term aiming for classification as target.
      :return: A tuple holding the current logits, `L_2` distortion and overall loss.
      """
      l2dist = np.sum(
          np.square(x - x_adv).reshape(x_adv.shape[0], -1), axis=1
      )
      ratios = [1.0] + [
          int(new_size) / int(old_size)
          for new_size, old_size in zip(
              self.estimator.input_shape, x.shape[1:]
          )
      ]
      preds = self.estimator.predict(
          np.array(zoom(x_adv, zoom=ratios)), batch_size=self.batch_size
      )
      z_target = np.sum(preds * target, axis=1)
      z_other = np.max(
          preds * (1 - target)
          + (np.min(preds, axis=1) - 1)[:, np.newaxis] * target,
          axis=1,
      )
  
      if self.targeted:
          # If targeted, optimize for making the target class most likely
          loss = np.maximum(z_other - z_target + self.confidence, 0)
      else:
          # If untargeted, optimize for making any other class most likely
          loss = np.maximum(z_target - z_other + self.confidence, 0)
  
      return preds, l2dist, c_weight * loss + l2dist
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, Tuple, Any, TYPE_CHECKING
  import numpy
  from scipy.ndimage import zoom
  from tqdm.auto import trange
  from art.config import ART_NUMPY_DTYPE
  from art.attacks.attack import EvasionAttack
  from art.estimators.estimator import BaseEstimator
  from art.estimators.classification.classifier import ClassifierMixin
  from art.utils import compute_success, get_labels_np_array, check_and_transform_label_format
label_desc: Use image node_id 2 for calling the ZooAttack obj's underlying member method code with example usage: obj._loss(x, x_adv, target, c_weight) and returns: preds,  l2dist,  unknown