Hi there!
I have updated to the new version of DGL 0.5.1 (thanks so much for the GPU support!) and am getting an error with the data type torch.int64
and the device context coda:0
when I am trying to build a subgraph.
Here is a code snippet:
data_dict = {
('user', 'plays', 'game'): (torch.tensor([0, 1, 2, 3]), torch.tensor([0, 0, 1, 1])),
('person', 'watches', 'movie'): (torch.tensor([0, 1, 2]), torch.tensor([0, 0, 0]))
}
num_nodes_dict = {'user': 4, 'game': 2, 'person': 3, 'movie': 1}
device = torch.device('cuda')
parent_graph = dgl.heterograph(data_dict=graph_dict, num_nodes_dict=num_nodes_dict, device=device)
nodes_dict_tensor = {'user': torch.tensor([0,1]), 'game': torch.tensor([0])}
subgraph = dgl.node_subgraph(graph=parent_graph, nodes=nodes_dict_tensor)
The error I am getting is as follows:
dgl._ffi.base.DGLError: Expect argument "nodes["user"]" to have data type torch.int64 and device context cpu. But got torch.int64 and cuda:0.
What should the input format of the data_dict or the nodes_dict_tensor be like to avoid this error?
I would be thankful for a hint!
Best,
Sophia