Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF2: CarliniWagnerL2 fails if argument y is provided and batch size is unequal to number of samples #1241

Open
thijs-vanweezel opened this issue Jan 22, 2024 · 0 comments

Comments

@thijs-vanweezel
Copy link

The issue tracker should only be used to report bugs or feature requests. If you are looking for support from other library users, please ask a question on StackOverflow.

Describe the bug
If an argument for parameter y is provided in the function carlini_wagner_l2, the error below is raised, and the only way to avoid this is to set argument batch_size equal to the number of samples in y.
CarliniWagnerL2Exception: x and y do not have the same shape!

To Reproduce

import tensorflow as tf
from cleverhans.tf2.attacks.carlini_wagner_l2 import carlini_wagner_l2

(x, y), _ = tf.keras.datasets.cifar10.load_data()
x = tf.image.convert_image_dtype(y, dtype=tf.float32)

# <load model here>

x_adv = carlini_wagner_l2(classifier, x=x[:8], y=y[:8], max_iterations=10, batch_size=4) # arguments chosen for time concerns

Expected behavior
Just like x, the argument y should be split into batches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant