Change in Attack.Py addressing Issue
Addressing issue Made changes to comment so it follows PEP8 guideline
@@ -198,8 +198,8 @@ class Attack(object):
The kwargs are fed directly from the kwargs of the attack.
If 'y' is in kwargs, then assume it's an untargeted attack and
use that as the label.
- If 'y_target' is in kwargs, then assume it's a targeted attack and
- use that as the label.
+ If 'y_target' is in kwargs and is not none, then assume it's a
+ targeted attack and use that as the label.
Otherwise, use the model's prediction as the label and perform an
untargeted attack.
"""
@@ -209,7 +209,7 @@ class Attack(object):
raise ValueError("Can not set both 'y' and 'y_target'.")
elif 'y' in kwargs:
labels = kwargs['y']
- elif 'y_target' in kwargs:
+ elif 'y_target' in kwargs and kwargs['y_target'] is not None:
labels = kwargs['y_target']
else:
preds = self.model.get_probs(x)
