pelican.primitives.aggregate_2to0

pelican.primitives.aggregate_2to0(edges, edge_index, batch, reduce='mean', G=None, **kwargs)[source]

Aggregate from edges (rank 2) to graph (rank 0).

Parameters:
  • edges (torch.Tensor) – Edge-level features of shape (E, C).

  • edge_index (torch.Tensor) – Edge index tensor of shape (2, E).

  • batch (torch.Tensor) – Batch tensor of shape (N).

  • reduce (str, optional) – Reduction method to use (‘mean’, ‘sum’, ‘prod’, ‘amin’, ‘amax’), by default ‘mean’.

  • G (int, optional) – Number of graphs in the batch. If None, it will be inferred from the batch tensor.

  • **kwargs

Returns:

ops – Aggregated features of shape (G, C, 2).

Return type:

torch.Tensor