pelican.layers.GeneralAggregator
- class pelican.layers.GeneralAggregator(aggregator, in_rank, out_rank, in_channels, out_channels, map_multipliers=True, factorize=False, aggr='mean')[source]
Bases:
ModuleGeneral aggregator class.
- Parameters:
aggregator (callable) – Aggregation function to use.
in_rank (int) – Input rank (0 for graph, 1 for nodes, 2 for edges).
out_rank (int) – Output rank (0 for graph, 1 for nodes, 2 for edges).
in_channels (int) – Number of input channels.
out_channels (int) – Number of output channels.
map_multipliers (bool) – Whether to use learnable multipliers for each aggregation map, by default True.
factorize (bool) – Whether to use factorized coefficients, by default False. Factorization reduces the number of parameters.
aggr (str) – Aggregation method to use (‘mean’, ‘sum’, ‘prod’, ‘amin’, ‘amax’), by default ‘mean’.
- property coeffs
- forward(x, *args, **kwargs)[source]
Forward pass of the aggregator.
- Parameters:
x (torch.Tensor) – Input features of shape (in_objects, in_channels).
*args – Additional arguments to pass to the aggregator.
**kwargs – Additional keyword arguments to pass to the aggregator.
- Returns:
out – Output features of shape (out_objects, in_channels).
- Return type:
torch.Tensor