"git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "3f3652e0a7e58278b1d79901b5a5987fb31ad2d9"
Unverified Commit ee9093f5 authored by Mufei Li's avatar Mufei Li Committed by GitHub
Browse files

Update message-efficient.rst (#2247)

parent 8ad7c3e8
...@@ -59,7 +59,7 @@ implementation would be like: ...@@ -59,7 +59,7 @@ implementation would be like:
linear = nn.Parameter(torch.FloatTensor(size=(1, node_feat_dim * 2))) linear = nn.Parameter(torch.FloatTensor(size=(1, node_feat_dim * 2)))
def concat_message_function(edges): def concat_message_function(edges):
{'cat_feat': torch.cat([edges.src.ndata['feat'], edges.dst.ndata['feat']])} return {'cat_feat': torch.cat([edges.src.ndata['feat'], edges.dst.ndata['feat']])}
g.apply_edges(concat_message_function) g.apply_edges(concat_message_function)
g.edata['out'] = g.edata['cat_feat'] * linear g.edata['out'] = g.edata['cat_feat'] * linear
...@@ -87,4 +87,4 @@ The above two implementations are mathematically equivalent. The latter ...@@ -87,4 +87,4 @@ The above two implementations are mathematically equivalent. The latter
one is more efficient because it does not need to save feat_src and one is more efficient because it does not need to save feat_src and
feat_dst on edges, which is not memory-efficient. Plus, addition could feat_dst on edges, which is not memory-efficient. Plus, addition could
be optimized with DGL’s built-in function ``u_add_v``, which further be optimized with DGL’s built-in function ``u_add_v``, which further
speeds up computation and saves memory footprint. speeds up computation and saves memory footprint.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment