This commit is contained in:
Nataniel Ruiz
2019-12-26 09:34:58 -04:00
parent 6689912c98
commit 466d927a7c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ class TestModel(BaseModel):
pgd_attack = attacks.LinfPGDAttack(model=self.netG)
black = np.zeros((1, 3, image.size(2), image.size(3)))
black = torch.FloatTensor(black).cuda()
input_adv, perturb = pgd_attack.perturb(image, black)
input_adv, perturb = pgd_attack.perturb(image, image)
return input_adv, perturb
+1 -1
View File
@@ -27,7 +27,7 @@ class LinfPGDAttack(object):
output = self.model(X)
self.model.zero_grad()
loss = -self.loss_fn(output, y)
loss = self.loss_fn(output, y)
loss.backward()
grad = X.grad