torch_geometric.nn.pool.avg_pool_x
- avg_pool_x(cluster: Tensor, x: Tensor, batch: Tensor, batch_size: Optional[int] = None, size: Optional[int] = None) Tuple[Tensor, Optional[Tensor]][source]
Average pools node features according to the clustering defined in
cluster. Seetorch_geometric.nn.pool.max_pool_x()for more details.- Parameters
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.
batch_size (int, optional) – The number of examples \(B\). Automatically calculated if not given. (default:
None)size (int, optional) – The maximum number of clusters in a single example. (default:
None)
- Return type
(
torch.Tensor,torch.Tensor) ifsizeisNone, elsetorch.Tensor