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

Supporting nn.BCEWithLogitsLoss() ? #70

Closed FrankWJW closed 2 years ago

FrankWJW commented 2 years ago

I try a multi-label classification problem with torchattacks.FGSM(net, eps=0.1) image

I don't know if this make sense, but considering adding support for different type of loss function such as nn.BCEWithLogitsLoss() may be good?

Harry24k commented 2 years ago

Simply, you can modify the model to use nn.CrossEntropyLoss. However, supporting diverse loss functions is quite interesting. Actually, torchattacks.UPGD supports three different loss options. Thank you for your suggestion.