@call_decorator<EOL><INDENT>def __call__(self, input_or_adv, label=None, unpack=True,<EOL>max_iter=<NUM_LIT:100>,<EOL>eta=<NUM_LIT>):<DEDENT>
a = input_or_adv<EOL>del input_or_adv<EOL>del label<EOL>del unpack<EOL>if not a.has_gradient():<EOL><INDENT>return<EOL><DEDENT>if a.target_class() is not None:<EOL><INDENT>logging.fatal('<STR_LIT>')<EOL>return<EOL><DEDENT>l2_norm = np.linalg.norm(a.original_image)<EOL>min_, max_ = a.bounds()<EOL>perturbed_image = a.original_image.copy()<EOL>for i in range(max_iter):<EOL><INDENT>logits, gradients, is_adversarial =a.predictions_and_gradient(perturbed_image)<EOL>if is_adversarial:<EOL><INDENT>return<EOL><DEDENT>score = np.max(softmax(logits))<EOL>gradients = -gradients / score<EOL>gradient_l2_norm = np.linalg.norm(gradients)<EOL>delta = self._delta(eta, l2_norm, score,<EOL>gradient_l2_norm, a.num_classes())<EOL>current_pertubation = self._perturbation(delta,<EOL>gradients,<EOL>gradient_l2_norm)<EOL>perturbed_image += current_pertubation<EOL>perturbed_image = np.clip(perturbed_image, min_, max_)<EOL><DEDENT>
Parameters
----------
input_or_adv : `numpy.ndarray` or :class:`Adversarial`
    The original, unperturbed input as a `numpy.ndarray` or
    an :class:`Adversarial` instance.
label : int
    The reference label of the original input. Must be passed
    if `a` is a `numpy.ndarray`, must not be passed if `a` is
    an :class:`Adversarial` instance.
unpack : bool
    If true, returns the adversarial input, otherwise returns
    the Adversarial object.
max_iter : int
    The maximum number of iterations.
eta : float
    the eta coefficient