diff --git a/fluid/adversarial/advbox/attacks/iterator_gradientsign.py b/fluid/adversarial/advbox/attacks/iterator_gradientsign.py index 3fc96391d2049918e163ba296b749e522375ca57..646389a3ebf19025e94abc811713d5faf33098a8 100644 --- a/fluid/adversarial/advbox/attacks/iterator_gradientsign.py +++ b/fluid/adversarial/advbox/attacks/iterator_gradientsign.py @@ -12,6 +12,7 @@ class IteratorGradientSignAttack(Attack): This attack was originally implemented by Alexey Kurakin(Google Brain). Paper link: https://arxiv.org/pdf/1607.02533.pdf """ + def _apply(self, image_label, epsilons=100, steps=10): """ Apply the iterative gradient sign attack. @@ -22,7 +23,6 @@ class IteratorGradientSignAttack(Attack): Return: numpy.ndarray: The adversarail sample generated by the algorithm. """ - assert len(image_label) == 1 pre_label = np.argmax(self.model.predict(image_label)) gradient = self.model.gradient(image_label) @@ -41,4 +41,3 @@ class IteratorGradientSignAttack(Attack): adv_label = np.argmax(self.model.predict([(adv_img, 0)])) if pre_label != adv_label: return adv_img -