Remove function lp_norm, which has been defined in file other_utils
Initialize vars and run assertion in constructor
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.
This PR is a minor improvement.
lp_norm
, which has been defined in fileother_utils
normalize
, but I prefer the following implementationAlso, I noticed that function
check_shape
has been defined in APGD and FAB, butcheck_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 toother_utils
. Second, varadv_all
at end of Square attack is not defined.