@call_decorator<EOL><INDENT>def __call__(self, input_or_adv, label=None, unpack=True,<EOL>epsilon=<NUM_LIT>,<EOL>num_random_targets=<NUM_LIT:0>,<EOL>maxiter=<NUM_LIT>):<DEDENT>
a = input_or_adv<EOL>del input_or_adv<EOL>del label<EOL>del unpack<EOL>if not self._approximate_gradient and not a.has_gradient():<EOL><INDENT>return<EOL><DEDENT>original_class = a.original_class<EOL>target_class = a.target_class()<EOL>if target_class is None:<EOL><INDENT>if num_random_targets == <NUM_LIT:0> and self._approximate_gradient:<EOL><INDENT>num_random_targets = <NUM_LIT:1><EOL><DEDENT>if num_random_targets == <NUM_LIT:0>:<EOL><INDENT>gradient_attack = GradientAttack()<EOL>gradient_attack(a)<EOL>adv_img = a.image<EOL>if adv_img is None:  <EOL><INDENT>num_random_targets = <NUM_LIT:1><EOL>logging.warning('<STR_LIT>')  <EOL><DEDENT>else:<EOL><INDENT>logits, _ = a.predictions(adv_img)<EOL>target_class = np.argmax(logits)<EOL>target_classes = [target_class]<EOL>logging.info('<STR_LIT>'.format(target_class))  <EOL><DEDENT><DEDENT>if num_random_targets > <NUM_LIT:0>:<EOL><INDENT>num_classes = a.num_classes()<EOL>assert num_random_targets <= num_classes - <NUM_LIT:1><EOL>target_classes = rng.sample(<EOL>range(num_classes), num_random_targets + <NUM_LIT:1>)<EOL>target_classes = [t for t in target_classes if t != original_class]  <EOL>target_classes = target_classes[:num_random_targets]<EOL>str_target_classes = [str(t) for t in target_classes]<EOL>logging.info('<STR_LIT>'.format('<STR_LIT:U+002CU+0020>'.join(str_target_classes)))  <EOL><DEDENT><DEDENT>else:<EOL><INDENT>target_classes = [target_class]<EOL><DEDENT>a._reset()<EOL>for i, target_class in enumerate(target_classes):<EOL><INDENT>self._optimize(<EOL>a, target_class,<EOL>epsilon=epsilon, maxiter=maxiter)<EOL>if len(target_classes) > <NUM_LIT:1>:  <EOL><INDENT>logging.info('<STR_LIT>'.format(i + <NUM_LIT:1>, a.distance))<EOL><DEDENT><DEDENT>
Uses L-BFGS-B to minimize the distance between the image and the
        adversarial as well as the cross-entropy between the predictions for
        the adversarial and the the one-hot encoded target class.

        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.
        epsilon : float
            Epsilon of the binary search.
        num_random_targets : int
            Number of random target classes if no target class is given
            by the criterion.
        maxiter : int
            Maximum number of iterations for L-BFGS-B.