dgl._ffi.base.DGLError: DGLGraph.send is deprecated. As a replacement, use DGLGraph.apply_edges API to compute messages as edge data

Hi All

I faced a problem which I’m dealing with for two weeks.
I developed my GCN code based on the link below:

https://docs.dgl.ai/en/0.2.x/tutorials/basics/1_first.html

I’m facing an error for this part:

class GCNLayer(nn.Module):
def init(self, in_feats, out_feats):
super(GCNLayer, self).init()
self.linear = nn.Linear(in_feats, out_feats)

def forward(self, g, inputs):
    # g is the graph and the inputs is the input node features
    # first set the node features
    g.ndata['h'] = inputs
    # trigger message passing on all edges
    g.send(g.edges(), gcn_message)
    # trigger aggregation at all nodes
    g.recv(g.nodes(), gcn_reduce)
    # get the result node features
    h = g.ndata.pop('h')
    # perform linear transformation
    return self.linear(h)

I’m getting an error below:

dgl._ffi.base.DGLError: DGLGraph.send is deprecated. As a replacement, use DGLGraph.apply_edges API to compute messages as edge data. Then use DGLGraph.send_and_recv and set the message function as dgl.function.copy_e to conduct message aggregation*

I wonder to know how can I use DGLGraph.apply_edges instead of DGLGraph.send. In DGLGraph.send we have arguments g.edges() and gcn_message. How these arguments can be converted to the arguments required for DGLGraph.apply_edges which are `` (func, edges=‘ALL, etype=None, inplace=False )?

Also, the same for DGLGraph.send_and_recv. InDGLGraph.recv we had two arguments g.nodes() and gcn_reduce. How these arguments can be converted to the arguments required for
Also, the same for which are `` (edges, message_func, reduce_func, apply_node_func=None, etype=None, inplace=False )?

I would be very grateful if you can help me with this big challenge.

Thank you

You are following a very old tutorial for DGL 0.2.x while the latest version is 0.8.x. Could you try following these?

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