qilong-zhang / Pytorch_Universal-adversarial-perturbation

A PyTorch implementation of universal adversarial perturbation (UAP) which is more easy to understand and implement.
54 stars 5 forks source link

The location of Normalization is confusing #3

Closed Huang-yihao closed 2 years ago

Huang-yihao commented 2 years ago

I wonder why put normalization in line 20 instead of simply putting it to the last of transform (the location is shown in the green box)? The result becomes wrong when I put the normalization into transform. It really confuses me. Could you please answer the question? Thanks very much!

image

qilong-zhang commented 2 years ago

@hyhchaos, it is necessary to put Normalize to line 20. Note that if you put it to line 26, input x is no longer in [0,1].

Huang-yihao commented 2 years ago

Thanks for your answer!