I have a DGLHeteroGraph
, and I want to process it as a homo-graph after some operation and calling dgl.to_homo()
, however this method still returns a DGLHeteroGraph
. If I want to use NN modules on it,
homo_g = dgl.to_homo(g)
self.gat1 = GATConv(in_feats=self.entity_dim, out_feats=8, num_heads=8, activation=nn.ELU(),
feat_drop=0.6, attn_drop=0.6)
node_feats = self.gat1(homo_g, homo_g.nodes['_N'].data['feature'])
the following error would occur,
File "/home/weiguoao/anaconda3/envs/wga/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "/home/weiguoao/projects/KG-GAT/models.py", line 167, in forward
node_feats = self.gat1(homo_g, homo_g.nodes['_N'].data['feature'])
File "/home/weiguoao/anaconda3/envs/wga/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "/home/weiguoao/anaconda3/envs/wga/lib/python3.7/site-packages/dgl/nn/pytorch/conv/gatconv.py", line 111, in forward
graph.edata['a'] = self.attn_drop(edge_softmax(graph, e))
File "/home/weiguoao/anaconda3/envs/wga/lib/python3.7/site-packages/dgl/nn/pytorch/softmax.py", line 179, in edge_softmax
return EdgeSoftmax.apply(graph, logits, eids)
File "/home/weiguoao/anaconda3/envs/wga/lib/python3.7/site-packages/dgl/nn/pytorch/softmax.py", line 52, in forward
gidx = g._graph.get_immutable_gidx(utils.to_dgl_context(score.device))
File "dgl/_ffi/_cython/./object.pxi", line 64, in dgl._ffi._cy3.core.ObjectBase.__getattr__
AttributeError: '<class 'dgl.heterograph_index.HeteroGraphIndex'>' object has no attribute 'get_immutable_gidx'
is there any way I could apply NN modules on homo DGLHeteroGraph
? Maybe I can convert DGLHeteroGraph
to DGLGraph
?
OS: Ubuntu 16.04
DGL version: dgl-cu100 0.4.2