AGNNConv
¶
Bases: MessagePassing
Graph attentional propagation layer from the "Attention-based Graph Neural Network for Semi-Supervised Learning" paper.
where the propagation matrix \(\mathbf{P}\) is computed as
with a (trainable) temperature \(\beta\). The layer keeps the size of the node features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requires_grad
|
bool
|
Whether \(\beta\) is trainable (it is fixed to 1
otherwise). Default: |
True
|
add_self_loops
|
bool
|
Whether to replace the self-loops of the graph by one
self-loop per node. Default: |
True
|
**kwargs
|
Arguments of |
{}
|
Example:
import mlx.core as mx
from mlx_graphs.nn import AGNNConv
edge_index = mx.array([[0, 1, 2, 3, 4], [1, 0, 3, 2, 0]])
node_features = mx.random.normal((5, 16))
conv = AGNNConv()
h = conv(edge_index, node_features)
>>> h.shape
(5, 16)
References
[1] Thekumparampil et al. Attention-based Graph Neural Network for Semi-Supervised Learning.
Methods:
| Name | Description |
|---|---|
__call__ |
Computes the forward pass of AGNNConv. |
Source code in mlx_graphs/nn/conv/agnn_conv.py
__call__
¶
Computes the forward pass of AGNNConv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_index
|
array
|
Input edge index of shape |
required |
node_features
|
array
|
Input node features |
required |
Returns:
| Type | Description |
|---|---|
array
|
The computed node embeddings |
Source code in mlx_graphs/nn/conv/agnn_conv.py
from mlx_graphs.nn import AGNNConv · mlx_graphs/nn/conv/agnn_conv.py