adversarial-robustness-toolbox
adversarial-robustness-toolbox copied to clipboard
API Inconsistency: AdversarialPatchPytorch silently ignores labels in untargeted mode rather than throwing a ValueError
Describe the bug A clear and concise description of what the bug is.
AdversarialPatchPytorch does not throw a ValueError when user does not provide labels during a targeted AdversarialPatch attack. This could potentially allow for users to not realize that the attack is behaving in a manner that they are not expecting.
The ValueError message for the RobustDPatch untargeted attack when the user provides labels is slightly vague and it may not be clear to the user why the error is being thrown.
To Reproduce Steps to reproduce the behavior:
The below code snippets is the script that I used to replicate conducting a targeted AdversarialPatchPytorch attack on a model where the labels are not provided by the user.
As you can see below, when running the script, no ValueError is thrown when labels are not provided by the user during a targeted AdversarialPatch attack.
Expected behavior A clear and concise description of what you expected to happen.
The expected behavior is that the AdversarialPatchPytorch targeted attack throws a ValueError when the user doesn't provide labels. This clearly lets the user know that the labels which they provided will not be used for the untargeted attack.
The ValueError message for the RobustDPatch untargeted attack when the user provides labels is clear so that the user understands exactly why the error is being thrown.
Screenshots n/a
System information (please complete the following information):
- OS =
Windows 11 - Python version =
3.9 - ART version =
1.19.1 - PyTorch version =
2.7.0