def _attack_success(self, adv_x, x, target_class):
        """
        Checks whether the given perturbation `adv_x` for the image `img` is successful.
        """
        adv = self._perturb_image(adv_x, x)

        if self.rescale:
            adv = self.rescale_input(adv)

        predicted_class = np.argmax(self.estimator.predict(adv)[0])
        return bool(
            (self.targeted and predicted_class == target_class)
            or (not self.targeted and predicted_class != target_class)
        )

        Checks whether the given perturbation `adv_x` for the image `img` is successful.
        
art/attacks/evasion/pixel_threshold.py