Hey there,
I’m trying to create a graph classifier for heterogeneous graphs in google Colab using Cuda 10.1 and PyTorch backend with dgl 0.5.
When the forward function is called i get this error:
DGLError: [07:58:12] /opt/dgl/src/array/array.cc:606: Operator COOGetRowNNZ does not support cuda device.
This caused when I’m trying to use HeteroGraphConv
.
Is it not supported? or you have any suggestions on what should I check I did wrong.
Thanks in advance!
here is the full stack trace:
---> 89 res, reps = model(all_graphs)
90 pred = res.argmax(1)
91 train_acc = (pred == torch.tensor(all_labels)).float().mean()
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
<ipython-input-13-55b264750139> in forward(self, g)
34 h = g.ndata['feat']
35 # Apply graph convolution and activation.
---> 36 h = self.conv1(g, h)
37 h = {key: F.relu(h[key]) for key in h.keys()}
38 h = self.conv2(g, h)
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
/usr/local/lib/python3.6/dist-packages/dgl/nn/pytorch/hetero.py in forward(self, g, inputs, mod_args, mod_kwargs)
172 inputs[stype],
173 *mod_args.get(etype, ()),
--> 174 **mod_kwargs.get(etype, {}))
175 outputs[dtype].append(dstdata)
176 rsts = {}
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
/usr/local/lib/python3.6/dist-packages/dgl/nn/pytorch/conv/graphconv.py in forward(self, graph, feat, weight)
248 feat_src, feat_dst = expand_as_pair(feat, graph)
249 if self._norm == 'both':
--> 250 degs = graph.out_degrees().float().clamp(min=1)
251 norm = th.pow(degs, -0.5)
252 shp = norm.shape + (1,) * (feat_src.dim() - 1)
/usr/local/lib/python3.6/dist-packages/dgl/heterograph.py in out_degrees(self, u, etype)
3267 if F.as_scalar(F.sum(self.has_nodes(u_tensor, ntype=srctype), dim=0)) != len(u_tensor):
3268 raise DGLError('u contains invalid node IDs')
-> 3269 deg = self._graph.out_degrees(etid, utils.prepare_tensor(self, u, 'u'))
3270 if isinstance(u, numbers.Integral):
3271 return F.as_scalar(deg)
/usr/local/lib/python3.6/dist-packages/dgl/heterograph_index.py in out_degrees(self, etype, v)
595 """
596 return F.from_dgl_nd(_CAPI_DGLHeteroOutDegrees(
--> 597 self, int(etype), F.to_dgl_nd(v)))
598
599 def adjacency_matrix(self, etype, transpose, ctx):
/usr/local/lib/python3.6/dist-packages/dgl/_ffi/_ctypes/function.py in __call__(self, *args)
188 check_call(_LIB.DGLFuncCall(
189 self.handle, values, tcodes, ctypes.c_int(num_args),
--> 190 ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
191 _ = temp_args
192 _ = args
/usr/local/lib/python3.6/dist-packages/dgl/_ffi/base.py in check_call(ret)
60 """
61 if ret != 0:
---> 62 raise DGLError(py_str(_LIB.DGLGetLastError()))
63
64
DGLError: [07:58:12] /opt/dgl/src/array/array.cc:606: Operator COOGetRowNNZ does not support cuda device.
Stack trace:
[bt] (0) /usr/local/lib/python3.6/dist-packages/dgl/libdgl.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x22) [0x7f0743867e02]
[bt] (1) /usr/local/lib/python3.6/dist-packages/dgl/libdgl.so(dgl::aten::COOGetRowNNZ(dgl::aten::COOMatrix, dgl::runtime::NDArray)+0xc9) [0x7f074385bb19]
[bt] (2) /usr/local/lib/python3.6/dist-packages/dgl/libdgl.so(dgl::UnitGraph::COO::OutDegrees(unsigned long, dgl::runtime::NDArray) const+0x102) [0x7f07440bd9c2]
[bt] (3) /usr/local/lib/python3.6/dist-packages/dgl/libdgl.so(dgl::UnitGraph::OutDegrees(unsigned long, dgl::runtime::NDArray) const+0x61) [0x7f07440b6241]
[bt] (4) /usr/local/lib/python3.6/dist-packages/dgl/libdgl.so(dgl::HeteroGraph::OutDegrees(unsigned long, dgl::runtime::NDArray) const+0x45) [0x7f0743fdffb5]
[bt] (5) /usr/local/lib/python3.6/dist-packages/dgl/libdgl.so(+0xf4ab95) [0x7f0743fedb95]
[bt] (6) /usr/local/lib/python3.6/dist-packages/dgl/libdgl.so(DGLFuncCall+0x52) [0x7f0743f6e232]
[bt] (7) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f07b31a2dae]
[bt] (8) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x22f) [0x7f07b31a271f]