Closed samuelemarro closed 4 years ago
BasicIterativeAttack's constructor calls PGDAttack using positional arguments. For example, the L2 variant looks like this:
super(L2BasicIterativeAttack, self).__init__( predict, loss_fn, eps, nb_iter, eps_iter, rand_init, clip_min, clip_max, ord, targeted)
However, PGDAttack's constructor looks like this:
def __init__( self, predict, loss_fn=None, eps=0.3, nb_iter=40, eps_iter=0.01, rand_init=True, clip_min=0., clip_max=1., ord=np.inf, l1_sparsity=None, targeted=False):
Notice l1_sparsity=None between ord and targeted. This means that the value of targeted is assigned to PGDAttack.l1_sparsity instead of PGDAttack.targeted, while PGDAttack.targeted will always be the default value (False).
l1_sparsity=None
ord
targeted
PGDAttack.l1_sparsity
PGDAttack.targeted
False
@samuelemarro Thanks for pointing this out! Do you want to submit a pull request fixing this?
Done! See #67 .
Merged
BasicIterativeAttack's constructor calls PGDAttack using positional arguments. For example, the L2 variant looks like this:
However, PGDAttack's constructor looks like this:
Notice
l1_sparsity=None
betweenord
andtargeted
. This means that the value oftargeted
is assigned toPGDAttack.l1_sparsity
instead ofPGDAttack.targeted
, whilePGDAttack.targeted
will always be the default value (False
).