dgl.function.sum¶
-
dgl.function.
sum
(msg, out)[source]¶ Builtin reduce function that aggregates messages by sum.
Parameters: Examples
>>> import dgl >>> reduce_func = dgl.function.sum(msg='m', out='h')
The above example is equivalent to the following user defined function (if using PyTorch):
>>> import torch >>> def reduce_func(nodes): >>> return {'h': torch.sum(nodes.mailbox['m'], dim=1)}