avg_pool_x(cluster: Tensor, x: Tensor, batch: Tensor, size: Optional[int] = None) Tuple[Tensor, Optional[Tensor]][source]

Average pools node features according to the clustering defined in cluster. See torch_geometric.nn.pool.max_pool_x() for more details.

  • cluster (torch.Tensor) – The cluster vector \(\mathbf{c} \in \{ 0, \ldots, N - 1 \}^N\), which assigns each node to a specific cluster.

  • x (Tensor) – The node feature matrix.

  • batch (torch.Tensor) – The batch vector \(\mathbf{b} \in {\{ 0, \ldots, B-1\}}^N\), which assigns each node to a specific example.

  • size (int, optional) – The maximum number of clusters in a single example. (default: None)

Return type

(torch.Tensor, torch.Tensor) if size is None, else torch.Tensor