GMMConv
¶
GMMConv(
node_features_dim: Union[int, Tuple[int, int]],
out_features_dim: int,
dim: int,
kernel_size: int,
separate_gaussians: bool = False,
aggr: str = "mean",
root_weight: bool = True,
bias: bool = True,
**kwargs,
)
Bases: MessagePassing
The Gaussian mixture model convolutional operator from the "Geometric Deep Learning on Graphs and Manifolds using Mixture Model CNNs" paper.
where
denotes a weighting function based on trainable mean vectors
\(\mathbf{\mu}_k\) and diagonal covariance matrices
\(\mathbf{\Sigma}_k\) (sigma). As in PyG, the sum over the kernels
is not divided by \(K\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features_dim
|
Union[int, Tuple[int, int]]
|
Size of the input features, or a |
required |
out_features_dim
|
int
|
Size of the output features. |
required |
dim
|
int
|
Pseudo-coordinate dimensionality. |
required |
kernel_size
|
int
|
Number of kernels \(K\). |
required |
separate_gaussians
|
bool
|
If |
False
|
aggr
|
str
|
Aggregation of the messages. Default: |
'mean'
|
root_weight
|
bool
|
Whether to add the transformed root node features.
Default: |
True
|
bias
|
bool
|
Whether to add a bias. Default: |
True
|
**kwargs
|
Arguments of |
{}
|
Example:
import mlx.core as mx
from mlx_graphs.nn import GMMConv
edge_index = mx.array([[0, 1, 2, 3], [1, 0, 3, 2]])
x = mx.random.normal((4, 16))
pseudo = mx.random.uniform(shape=(4, 2))
conv = GMMConv(16, 32, dim=2, kernel_size=4)
>>> conv(edge_index, x, pseudo).shape
(4, 32)
Methods:
| Name | Description |
|---|---|
__call__ |
Computes the forward pass of GMMConv. |
Source code in mlx_graphs/nn/conv/gmm_conv.py
__call__
¶
__call__(
edge_index: array,
node_features: Union[array, Tuple[array, array]],
edge_features: array,
) -> array
Computes the forward pass of GMMConv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
Edges of shape |
required |
node_features
|
Union[array, Tuple[array, array]]
|
Node features, or a |
required |
edge_features
|
array
|
Pseudo-coordinates of shape |
required |
Returns:
| Type | Description |
|---|---|
array
|
The features of the destination nodes. |
Source code in mlx_graphs/nn/conv/gmm_conv.py
from mlx_graphs.nn import GMMConv · mlx_graphs/nn/conv/gmm_conv.py