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: Run the attack on a batch of images and labels.
  
  :param x_batch: A batch of original examples.
  :param y_batch: A batch of targets (0-1 hot).
  :return: A batch of adversarial examples.
docstr_tok: ["Run","the","attack","on","a","batch","of","images","and","labels",".",":","param","x_batch",":","A","batch","of","original","examples",".",":","param","y_batch",":","A","batch","of","targets","(","0-1","hot",")",".",":","return",":","A","batch","of","adversarial","examples","."]
code: def _generate_batch(
      self, x_batch: np.ndarray, y_batch: np.ndarray
  ) -> np.ndarray:
      """
      Run the attack on a batch of images and labels.
  
      :param x_batch: A batch of original examples.
      :param y_batch: A batch of targets (0-1 hot).
      :return: A batch of adversarial examples.
      """
      # Initialize binary search
      c_current = self.initial_const * np.ones(x_batch.shape[0])
      c_lower_bound = np.zeros(x_batch.shape[0])
      c_upper_bound = 1e10 * np.ones(x_batch.shape[0])
  
      # Initialize best distortions and best attacks globally
      o_best_dist = np.inf * np.ones(x_batch.shape[0])
      o_best_attack = x_batch.copy()
  
      # Start with a binary search
      for bss in range(self.binary_search_steps):
          logger.debug(
              "Binary search step %i out of %i (c_mean==%f)",
              bss,
              self.binary_search_steps,
              np.mean(c_current),
          )
  
          # Run with 1 specific binary search step
          best_dist, best_label, best_attack = self._generate_bss(
              x_batch, y_batch, c_current
          )
  
          # Update best results so far
          o_best_attack[best_dist < o_best_dist] = best_attack[
              best_dist < o_best_dist
          ]
          o_best_dist[best_dist < o_best_dist] = best_dist[
              best_dist < o_best_dist
          ]
  
          # Adjust the constant as needed
          c_current, c_lower_bound, c_upper_bound = self._update_const(
              y_batch,
              best_label,
              c_current,
              c_lower_bound,
              c_upper_bound,
          )
  
      return o_best_attack
  
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 4 for calling the ZooAttack obj's underlying member method code with example usage: obj._generate_batch(x_batch, y_batch) and returns: o_best_attack