def generate(self, x, **kwargs):
    '\n        Generate adversarial samples and return them in an array.\n\n        :param x: An array with the original inputs to be attacked.\n        :type x: `np.ndarray`\n        :param y: If `self.targeted` is true, then `y` represents the target labels. Otherwise, the targets are the\n                  original class labels.\n        :type y: `np.ndarray`\n        :return: An array holding the adversarial examples.\n        :rtype: `np.ndarray`\n        '
    x_adv = x.astype(NUMPY_DTYPE)
    (clip_min, clip_max) = self.classifier.clip_values
    params_cpy = dict(kwargs)
    y = params_cpy.pop(str('y'), None)
    self.set_params(**params_cpy)
    if (self.targeted and (y is None)):
        raise ValueError('Target labels `y` need to be provided for a targeted attack.')
    if (y is None):
        y = get_labels_np_array(self.classifier.predict(x, logits=False))
    nb_batches = int(np.ceil((x_adv.shape[0] / float(self.batch_size))))
    for batch_id in range(nb_batches):
        logger.debug('Processing batch %i out of %i', batch_id, nb_batches)
        (batch_index_1, batch_index_2) = ((batch_id * self.batch_size), ((batch_id + 1) * self.batch_size))
        x_batch = x_adv[batch_index_1:batch_index_2]
        y_batch = y[batch_index_1:batch_index_2]
        x_adv[batch_index_1:batch_index_2] = self._generate_batch(x_batch, y_batch)
    x_adv = np.clip(x_adv, clip_min, clip_max)
    logger.info('Success rate of EAD attack: %.2f%%', (100 * compute_success(self.classifier, x, y, x_adv, self.targeted)))
    return x_adv
Generate adversarial samples and return them in an array.

:param x: An array with the original inputs to be attacked.
:type x: `np.ndarray`
:param y: If `self.targeted` is true, then `y` represents the target labels. Otherwise, the targets are the
          original class labels.
:type y: `np.ndarray`
:return: An array holding the adversarial examples.
:rtype: `np.ndarray`
def generate(self, x, **kwargs):
    '\n        Generate adversarial samples and return them in an array.\n\n        :param x: An array with the original inputs to be attacked.\n        :type x: `np.ndarray`\n        :param y: If `self.targeted` is true, then `y` represents the target labels. Otherwise, the targets are the\n                  original class labels.\n        :type y: `np.ndarray`\n        :return: An array holding the adversarial examples.\n        :rtype: `np.ndarray`\n        '
    x_adv = x.astype(NUMPY_DTYPE)
    (clip_min, clip_max) = self.classifier.clip_values
    params_cpy = dict(kwargs)
    y = params_cpy.pop(str('y'), None)
    self.set_params(**params_cpy)
    if (self.targeted and (y is None)):
        raise ValueError('Target labels `y` need to be provided for a targeted attack.')
    if (y is None):
        y = get_labels_np_array(self.classifier.predict(x, logits=False))
    nb_batches = int(np.ceil((x_adv.shape[0] / float(self.batch_size))))
    for batch_id in range(nb_batches):
        logger.debug('Processing batch %i out of %i', batch_id, nb_batches)
        (batch_index_1, batch_index_2) = ((batch_id * self.batch_size), ((batch_id + 1) * self.batch_size))
        x_batch = x_adv[batch_index_1:batch_index_2]
        y_batch = y[batch_index_1:batch_index_2]
        x_adv[batch_index_1:batch_index_2] = self._generate_batch(x_batch, y_batch)
    x_adv = np.clip(x_adv, clip_min, clip_max)
    logger.info('Success rate of EAD attack: %.2f%%', (100 * compute_success(self.classifier, x, y, x_adv, self.targeted)))
    return x_adv