Harry24k / adversarial-attacks-pytorch

PyTorch implementation of adversarial attacks [torchattacks].
https://adversarial-attacks-pytorch.readthedocs.io/en/latest/index.html
MIT License
1.79k stars 338 forks source link

How to Change Distance Measure in FGSM #50

Closed aminullah6264 closed 2 years ago

aminullah6264 commented 2 years ago

Hi harry,

I have run the FGSM with default distance measure Linf. I can see there is PGDL2 class, however, I couldn't find FGSML2, How can I change it to L2 norm.

Harry24k commented 2 years ago

You can use FGSML2 by setting steps=1 and eps=alpha. For example, atk = PGDL2(model, eps=eps, alpha=eps, steps=1, random_start=True, eps_for_division=1e-10)