RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking arugment for argument mat2 in method wrapper_mm)
I also tried the codes in the official document by changing the parameter "device='cpu'" into "device='cuda'", it also raised the same error.
When trying to train a r_gcn model with the following code:
from deeprobust.graph.data import Dataset from deeprobust.graph.defense import RGCN data = Dataset(root='/tmp/', name='cora') adj, features, labels = data.adj, data.features, data.labels idx_train, idx_val, idx_test = data.idx_train, data.idx_val, data.idx_test rgcn = RGCN(nnodes=adj.shape[0],nfeat=features.shape[1], nhid=16, nclass=labels.max().item() + 1, dropout=0.5, device='cuda') rgcn.fit(features, adj, labels, idx_train) # train without earlystopping rgcn.fit(features, adj, labels, idx_train, idx_val, patience=30) # train with earlystopping rgcn.test(idx_test)
I encountered the following error:
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking arugment for argument mat2 in method wrapper_mm)
I also tried the codes in the official document by changing the parameter "device='cpu'" into "device='cuda'", it also raised the same error.