Closed PolarisRisingWar closed 2 years ago
I find bug in deeprobust/graph/defense/gcn.py
line180-186:
if normalize:
if utils.is_sparse_tensor(adj):
adj_norm = utils.normalize_adj_tensor(adj, sparse=True)
else:
adj_norm = utils.normalize_adj_tensor(adj)
else:
adj_norm = adj
After utils.normalize_adj_tensor()
, adj_norm will return to cuda
.
And in deeprobust/graph/utils.py
line202, the code is device = torch.device("cuda" if adj.is_cuda else "cpu")
.
I think this bug can be dealt by device=adj.device
maybe you should run git pull
first, the bug was fixed in 5c85bb69760bef9f37e1284cb136d45d60b8126c
OK, I got it! Honestly it's because I used pip to install this package coz I've met some strange problems when using git setup.py to install it. So I have to mannuly change the files my pip installed to fix this problem.
I'm using code like in this: https://github.com/DSE-MSU/DeepRobust/blob/master/examples/graph/test_nettack.py Just added a little changes. And I want to change device from
cuda:0
tocuda:1
in line 20device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
. It showed me such an error message:Honestly I don't know where one of these two tensors has changed to
cuda:0
..... Is there any place thatcuda:0
as device has hardly written?