dgl.function.max

dgl.function.max(msg, out)

内置的reduce函数,通过最大值聚合消息。

Parameters:
  • msg (str) – The message field.

  • out (str) – The output node feature field.

示例

>>> import dgl
>>> reduce_func = dgl.function.max('m', 'h')

上面的例子等同于以下用户定义的函数(如果使用 PyTorch):

>>> import torch
>>> def reduce_func(nodes):
>>>     return {'h': torch.max(nodes.mailbox['m'], dim=1)}