Skip to content

SumAggregation

Bases: Aggregation

Sums the elements of each set.

\[ \mathrm{sum}(\mathcal{X}) = \sum_{\mathbf{x}_i \in \mathcal{X}} \mathbf{x}_i. \]

Example:

import mlx.core as mx
from mlx_graphs.nn.aggr import SumAggregation

x = mx.array([[1.0], [2.0], [4.0]])
index = mx.array([0, 0, 1])
>>> SumAggregation()(x, index)
array([[3], [4]], dtype=float32)

from mlx_graphs.nn.aggr import SumAggregation · mlx_graphs/nn/aggr/basic.py