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

Fix Boundary Attack not working on MPS accelerator #44

Open
philswatton opened this issue Apr 14, 2023 · 0 comments
Open

Fix Boundary Attack not working on MPS accelerator #44

philswatton opened this issue Apr 14, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@philswatton
Copy link
Contributor

In the code introduced in #43, we explicitly prevent boundary attacks from being performed on MPS accelerators. This is because of foolbox's dependencies, which at some point create a numpy array (numpy has a default dtype of float64) which is then passed to eagerpy. eagerpy then passes this numpy array to torch.torch.as_tensor(a, device=self.raw.device), where self.raw.device will be "mps" if the input tensor to foolbox was on MPS. torch.as_tensor will inherit the float64 dtype from numpy (and numpy's default cannot be changed), causing an error when it attempts to create a float64 dtype tensor on MPS.

Any of the following could act as solutions:

  • finding an alternative to foolbox that does not depend on eagerpy
  • numpy allowing the default dtype to be easily altered in a script
  • MPS becoming float64-friendly
  • foolbox allowing arguments to the numpy array's creation (possibly we could wrap our own class around foolbox)

Links to the various steps to the final error:

@philswatton philswatton added the enhancement New feature or request label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant