In torchattacks/attacks/onepixel.py. there is a place where it wants to convert tensor to numpy but it needs to fist transfer the tensor to cpu which is not implemented I think :-?
💬 Detailed code and results
I use tensors on cuda as input to onepixel attack:
File "/usr/local/lib/python3.10/dist-packages/torchattacks/attacks/onepixel.py", line 100, in _loss
prob = self._get_prob(adv_images)[:, label]
File "/usr/local/lib/python3.10/dist-packages/torch/_tensor.py", line 970, in __array__
return self.numpy()
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
✨ Short description of the bug [tl;dr]
In
torchattacks/attacks/onepixel.py
. there is a place where it wants to convert tensor to numpy but it needs to fist transfer the tensor to cpu which is not implemented I think :-?💬 Detailed code and results
I use tensors on cuda as input to onepixel attack:
but got the following error: