Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Buhua-Liu committed Oct 15, 2021
1 parent 72c1734 commit f052294
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchattacks/attacks/eotpgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def forward(self, images, labels):
retain_graph=False,
create_graph=False)[0]

adv_images = adv_images.detach() + self.alpha*grad.sign()
adv_images = adv_images.detach() + self.alpha*grad.sign()/self.eot_iter
delta = torch.clamp(adv_images - images, min=-self.eps, max=self.eps)
adv_images = torch.clamp(images + delta, min=0, max=1).detach()

Expand Down

0 comments on commit f052294

Please sign in to comment.