@@ -15,7 +15,9 @@ class AdversarialTrainer:
1515 training on all adversarial data and other common setups. If multiple attacks are specified, they are rotated
1616 for each batch. If the specified attacks have as target a different model, then the attack is transferred. The
1717 `ratio` determines how many of the clean samples in each batch are replaced with their adversarial counterpart.
18- When the attack targets the current classifier, only successful adversarial samples are used.
18+
19+ .. warning:: Both successful and unsuccessful adversarial samples are used for training. In the case of
20+ unbounded attacks (e.g., DeepFool), this can result in invalid (very noisy) samples being included.
1921 """
2022 def __init__ (self , classifier , attacks , ratio = .5 ):
2123 """
@@ -71,7 +73,7 @@ def fit(self, x, y, batch_size=128, nb_epochs=20):
7173 self ._precomputed_adv_samples = []
7274 for attack in self .attacks :
7375 if 'targeted' in attack .attack_params :
74- if attack .targeted :
76+ if attack .targeted :
7577 raise NotImplementedError ("Adversarial training with targeted attacks is \
7678 currently not implemented" )
7779
@@ -153,7 +155,7 @@ def fit(self, x, y, **kwargs):
153155
154156 # Generate adversarial samples for each attack
155157 for i , attack in enumerate (self .attacks ):
156- if 'targeted' in attack .attack_params and attack .targeted :
158+ if 'targeted' in attack .attack_params and attack .targeted :
157159 raise NotImplementedError ("Adversarial training with targeted attacks is \
158160 currently not implemented" )
159161
0 commit comments