Closed ignaciogavier closed 1 year ago
Thank you for your work!
Same issues here, install the repo from pip, the lib from the pip is too old.
File "/home/hero/exp-code/0_attack.py", line 125, in test
adv_inputs = attack(inputs, targets)
File "/home/hero/.local/lib/python3.9/site-packages/torchattacks/attack.py", line 429, in __call__
adv_inputs = self.forward(inputs, labels, *args, **kwargs)
File "/home/hero/.local/lib/python3.9/site-packages/torchattacks/attacks/cw.py", line 84, in forward
f_loss = self.f(outputs, labels).sum()
File "/home/hero/.local/lib/python3.9/site-packages/torchattacks/attacks/cw.py", line 125, in f
one_hot_labels = torch.eye(len(outputs[0]))[labels].to(self.device)
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
The created tensor one_hot_labels was raising the following error when running on GPU: "RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)"
PR Type and Checklist
What kind of change does this PR introduce?
model
.supported_mode
wheter the attack supports targeted mode.