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