avg_pool_x
¶
avg_pool_x(
cluster: array,
x: array,
batch: array,
batch_size: Optional[int] = None,
size: Optional[int] = None,
) -> Tuple[array, Optional[array]]
Averages the features of the nodes of each cluster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cluster
|
array
|
Cluster of each node, of shape |
required |
x
|
array
|
Node features, of shape |
required |
batch
|
array
|
Graph of each node, of shape |
required |
batch_size
|
Optional[int]
|
The number of graphs (only used with |
None
|
size
|
Optional[int]
|
If given, the maximum number of clusters per graph: the output
then has |
None
|
Returns:
| Type | Description |
|---|---|
A tuple `(x, batch)`
|
the features of each cluster, in increasing |
Optional[array]
|
order of cluster id, and the graph of each cluster ( |
Tuple[array, Optional[array]]
|
|
Source code in mlx_graphs/nn/pooling/cluster_pooling.py
from mlx_graphs.nn import avg_pool_x · mlx_graphs/nn/pooling/cluster_pooling.py