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: Generate adversarial samples and return them in an array.
  
  :param x: An array with the original inputs to be attacked.
  :param y: Target values (class labels) one-hot-encoded of shape (nb_samples, nb_classes) or indices of shape
            (nb_samples,).
  :return: An array holding the adversarial examples.
docstr_tok: ["Generate","adversarial","samples","and","return","them","in","an","array",".",":","param","x",":","An","array","with","the","original","inputs","to","be","attacked",".",":","param","y",":","Target","values","(","class","labels",")","one-hot-encoded","of","shape","(","nb_samples",",","nb_classes",")","or","indices","of","shape","(","nb_samples",",",")",".",":","return",":","An","array","holding","the","adversarial","examples","."]
code: def generate(
      self, x: np.ndarray, y: Optional[np.ndarray] = None, **kwargs
  ) -> np.ndarray:
      """
      Generate adversarial samples and return them in an array.
  
      :param x: An array with the original inputs to be attacked.
      :param y: Target values (class labels) one-hot-encoded of shape (nb_samples, nb_classes) or indices of shape
                (nb_samples,).
      :return: An array holding the adversarial examples.
      """
      if y is not None:
          y = check_and_transform_label_format(
              y, nb_classes=self.estimator.nb_classes
          )
  
      # Check that `y` is provided for targeted attacks
      if self.targeted and y is None:  # pragma: no cover
          raise ValueError(
              "Target labels `y` need to be provided for a targeted attack."
          )
  
      # No labels provided, use model prediction as correct class
      if y is None:
          y = get_labels_np_array(
              self.estimator.predict(x, batch_size=self.batch_size)
          )
  
      if (
          self.estimator.nb_classes == 2 and y.shape[1] == 1
      ):  # pragma: no cover
          raise ValueError(
              "This attack has not yet been tested for binary classification with a single output classifier."
          )
  
      # Compute adversarial examples with implicit batching
      nb_batches = int(np.ceil(x.shape[0] / float(self.batch_size)))
      x_adv_list = []
      for batch_id in trange(
          nb_batches, desc="ZOO", disable=not self.verbose
      ):
          batch_index_1, batch_index_2 = (
              batch_id * self.batch_size,
              (batch_id + 1) * self.batch_size,
          )
          x_batch = x[batch_index_1:batch_index_2]
          y_batch = y[batch_index_1:batch_index_2]
          res = self._generate_batch(x_batch, y_batch)
          x_adv_list.append(res)
      x_adv = np.vstack(x_adv_list)
  
      # Apply clip
      if self.estimator.clip_values is not None:
          clip_min, clip_max = self.estimator.clip_values
          np.clip(x_adv, clip_min, clip_max, out=x_adv)
  
      # Log success rate of the ZOO attack
      logger.info(
          "Success rate of ZOO attack: %.2f%%",
          100
          * compute_success(
              self.estimator,
              x,
              y,
              x_adv,
              self.targeted,
              batch_size=self.batch_size,
          ),
      )
  
      return x_adv
  
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 3 for calling the ZooAttack obj's underlying member method code with example usage: obj.generate(x, y) and returns: x_adv