FeaStConv
¶
FeaStConv(
node_features_dim: int,
out_features_dim: int,
heads: int = 1,
add_self_loops: bool = True,
bias: bool = True,
**kwargs,
)
Bases: MessagePassing
The (translation-invariant) feature-steered convolutional operator from the "FeaStNet: Feature-Steered Graph Convolutions for 3D Shape Analysis" paper.
with \(q_h(\mathbf{x}_i, \mathbf{x}_j) = \mathrm{softmax}_j (\mathbf{u}_h^{\top}(\mathbf{x}_j - \mathbf{x}_i) + c_h)\), where \(H\) denotes the number of attention heads, and \(\mathbf{W}_h\), \(\mathbf{u}_h\) and \(c_h\) are trainable parameters. The softmax is taken over the heads, as in PyG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features_dim
|
int
|
Size of the input features. |
required |
out_features_dim
|
int
|
Size of the output features. |
required |
heads
|
int
|
Number of attention heads \(H\). Default: |
1
|
add_self_loops
|
bool
|
If |
True
|
bias
|
bool
|
Whether to add a bias. Default: |
True
|
**kwargs
|
Arguments of |
{}
|
Example:
import mlx.core as mx
from mlx_graphs.nn import FeaStConv
edge_index = mx.array([[0, 1, 2, 3], [1, 0, 3, 2]])
x = mx.random.normal((4, 16))
conv = FeaStConv(16, 32, heads=4)
>>> conv(edge_index, x).shape
(4, 32)
Methods:
| Name | Description |
|---|---|
__call__ |
Computes the forward pass of FeaStConv. |
Source code in mlx_graphs/nn/conv/feast_conv.py
__call__
¶
Computes the forward pass of FeaStConv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
Edges of shape |
required |
node_features
|
Union[array, Tuple[array, array]]
|
Node features, or a |
required |
Returns:
| Type | Description |
|---|---|
array
|
The features of the destination nodes. |
Source code in mlx_graphs/nn/conv/feast_conv.py
from mlx_graphs.nn import FeaStConv · mlx_graphs/nn/conv/feast_conv.py