You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Harry,
Thanks for your code.
Here’s the situation I meet:
My server has two gpus, which are cuda: 0 and cuda: 1. However, if I send my model to cuda: 1, then attack would change it to cuda: 0 instead.
Code is here:
torchattacks/attack.py line 20
self.device = torch.device("cuda" if next(model.parameters()).is_cuda else "cpu")
Could it be okay to change it to:
self.device = next(model.parameters()).device
I test the code based on torch=1.4.0
This could help me maintain the same device in both my model and datasets.
Thanks a lot.
Ruqi Bai
The text was updated successfully, but these errors were encountered:
Since I only use one GPU, I wasn't thinking about the problem at all.
I modified code as you suggested and checked there is no errors on demos.
Please check version 1.2!
Thank you.
Harry
Hi,
Thanks for your quick reply and update. Here's one same problem in torchattacks.py line: 30.
I don't find this file in the source code. But I do have one file in my package. (I use pip to import your package)
Hello Harry,
Thanks for your code.
Here’s the situation I meet:
My server has two gpus, which are cuda: 0 and cuda: 1. However, if I send my model to cuda: 1, then attack would change it to cuda: 0 instead.
Code is here:
torchattacks/attack.py line 20
self.device = torch.device("cuda" if next(model.parameters()).is_cuda else "cpu")
Could it be okay to change it to:
self.device = next(model.parameters()).device
I test the code based on torch=1.4.0
This could help me maintain the same device in both my model and datasets.
Thanks a lot.
Ruqi Bai
The text was updated successfully, but these errors were encountered: