Dgl.add_self_loop() Throws RuntimeError: Could not infer dtype of numpy.int64

Hey there!
I have my own dataset I created using the introductory tutorial. But when I try to use it in my model, I get the error that “There are 0-in-degree nodes in the graph, output for those nodes will be invalid.” in order to fix the problem, it says to add “g = dgl.add_self_loop(g)” to my code. However, dgl.add_self_loop causes the error “RuntimeError: Could not infer dtype of numpy.int64”, which is interesting becuase I’m not using any int’s in my graphs whatesever.

Here’s is what I get when I print the graph:
Graph(num_nodes=24, num_edges=50,
ndata_schemes={‘atomicNums’: Scheme(shape=(), dtype=torch.float64), ‘temperature’: Scheme(shape=(), dtype=torch.float64)}
edata_schemes={‘bondOrders’: Scheme(shape=(), dtype=torch.float64)})

I’m using the following versions:
torchVersion : 1.8.1 (PyTorch)
DGLVersion : 0.7.1
PythonVerision: 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]

Any ideas?

I should add, that I’ve been getting the same " [RuntimeError: Could not infer dtype of numpy.int64]" error in a variety of different situations. For example, I get the same error when completing tutorial found at Training a GNN for Graph Classification — DGL 0.7.1 documentation . In particular, the dataset = dgl.data.GINDataset(‘PROTEINS’, self_loop=True) command throws the error.

UPDATE: It appears that using a different version of DGL (0.6.0post1) fixed the problem. (Also switched to the most recent LTE of PyTorch 1.8.2, as well as Python 3.9.7)

Sorry this seems a bug for DGL on windows. Could you raise an issue in our github repo? Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.