Aggregators combine neighbor node features in graph neural networks. Each
aggregator implements a different reduction over the features of a node's
neighbors, and is passed to a layer that consumes one, such as
layer_sage().
Details
Available aggregators:
SumAggregator(): Sum of neighbor featuresMeanAggregator(): Mean of neighbor features (with row normalization)MaxAggregator(): Element-wise maximum of neighbor featuresMinAggregator(): Element-wise minimum of neighbor featuresProductAggregator(): Element-wise product of neighbor featuresVarAggregator(): Variance of neighbor featuresStdAggregator(): Standard deviation of neighbor features
Aggregator() is the abstract parent class and cannot be instantiated
directly. It is exported so that user-defined aggregators can subclass it
and register a forward() method.
See also
layer_sage(), which takes an aggregator.
Examples
MeanAggregator()
#> <torchgnn::MeanAggregator>
#> @ name : chr "mean"
#> @ learnable: logi FALSE
SumAggregator()
#> <torchgnn::SumAggregator>
#> @ name : chr "sum"
#> @ learnable: logi FALSE
# Aggregators are passed to the layers that consume them
S7::prop(MaxAggregator(), "name")
#> [1] "max"