fra31 / auto-attack

Code relative to "Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks"
https://arxiv.org/abs/2003.01690
MIT License
639 stars 111 forks source link

Minor improvement for APGD #93

Closed CNOCycle closed 2 years ago

CNOCycle commented 2 years ago

This PR is a minor improvement.

  1. Remove function lp_norm, which has been defined in file other_utils
  2. Initialize vars and run assertion in constructor
  3. Refine function normalize, but I prefer the following implementation
    de = t.view(-1, *([1] * self.ndims))
    ans = torch.where(de < 1e-12, x / (de + 1e-12), x / de)

Also, I noticed that function check_shape has been defined in APGD and FAB, but check_shape dose not be called in APGD. Similarly, some util functions are re-defined in Square attack. I would suggest that those functions should be moved to other_utils. Second, var adv_all at end of Square attack is not defined.

fra31 commented 2 years ago

Hi,

thanks for the improvements! I agree with you other suggestions too, I'll try to integrate them as soon as possible.