cleverhans
cleverhans copied to clipboard
Tensorflow 2 C&W2 implementation targeted bug
Hello, I have seen one possible bug in the tensorflow C&W2 implementation.
The targeted parameter does not pass to function body, instead it is defined with respect to y parameter being None or not. This causes problems when labels are explicitly given in untargeted scenario. https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans/tf2/attacks/carlini_wagner_l2.py#L25 https://github.com/cleverhans-lab/cleverhans/blob/e5d00e537ce7ad6119ed5a8db1f0e9736d1f6e1d/cleverhans/tf2/attacks/carlini_wagner_l2.py#L82 There might be two ways to fix this:
- One would be
self.targeted = targeted
- The other solution would be replacing default value of targeted to None and fixing line
targeted = None
on the argument list and
if targeted is not None:
self.targeted=targeted
else:
self.targeted = y is not None
in the body