def _generate_batch(self, x_batch, y_batch):
    '\n        Run the attack on a batch of images and labels.\n\n        :param x_batch: A batch of original examples.\n        :type x_batch: `np.ndarray`\n        :param y_batch: A batch of targets (0-1 hot).\n        :type y_batch: `np.ndarray`\n        :return: A batch of adversarial examples.\n        :rtype: `np.ndarray`\n        '
    c = (self.initial_const * np.ones(x_batch.shape[0]))
    c_lower_bound = np.zeros(x_batch.shape[0])
    c_upper_bound = (100000000000.0 * np.ones(x_batch.shape[0]))
    o_best_dist = (np.inf * np.ones(x_batch.shape[0]))
    o_best_attack = x_batch.copy()
    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))
        (best_dist, best_label, best_attack) = self._generate_bss(x_batch, y_batch, c)
        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)]
        (c, c_lower_bound, c_upper_bound) = self._update_const(y_batch, best_label, c, c_lower_bound, c_upper_bound)
    return o_best_attack
Run the attack on a batch of images and labels.

:param x_batch: A batch of original examples.
:type x_batch: `np.ndarray`
:param y_batch: A batch of targets (0-1 hot).
:type y_batch: `np.ndarray`
:return: A batch of adversarial examples.
:rtype: `np.ndarray`
def _generate_batch(self, x_batch, y_batch):
    '\n        Run the attack on a batch of images and labels.\n\n        :param x_batch: A batch of original examples.\n        :type x_batch: `np.ndarray`\n        :param y_batch: A batch of targets (0-1 hot).\n        :type y_batch: `np.ndarray`\n        :return: A batch of adversarial examples.\n        :rtype: `np.ndarray`\n        '
    c = (self.initial_const * np.ones(x_batch.shape[0]))
    c_lower_bound = np.zeros(x_batch.shape[0])
    c_upper_bound = (100000000000.0 * np.ones(x_batch.shape[0]))
    o_best_dist = (np.inf * np.ones(x_batch.shape[0]))
    o_best_attack = x_batch.copy()
    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))
        (best_dist, best_label, best_attack) = self._generate_bss(x_batch, y_batch, c)
        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)]
        (c, c_lower_bound, c_upper_bound) = self._update_const(y_batch, best_label, c, c_lower_bound, c_upper_bound)
    return o_best_attack