GAT
¶
GAT(
node_features_dim: int,
hidden_features_dim: int,
num_layers: int,
out_features_dim: Optional[int] = None,
heads: int = 1,
v2: bool = False,
**kwargs: Any,
)
Bases: BasicGNN
Graph Attention Network from "Graph Attention Networks" (or, with v2=True, "How Attentive are Graph Attention Networks?"), a
stack of GATConv / GATv2Conv
layers.
Hidden layers concatenate their heads attention heads, each of size
hidden_features_dim // heads. When out_features_dim is given, the
last layer averages its heads instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_features_dim
|
int
|
Size of the input node features. |
required |
hidden_features_dim
|
int
|
Size of the hidden node embeddings (all heads
together). Must be divisible by |
required |
num_layers
|
int
|
Number of message passing layers. |
required |
out_features_dim
|
Optional[int]
|
Size of the output. Default: |
None
|
heads
|
int
|
Number of attention heads. Default: |
1
|
v2
|
bool
|
Whether to use |
False
|
dropout
|
Dropout probability, applied after each hidden layer and, as
in PyG, to the attention coefficients of every layer.
Default: |
required | |
act
|
Activation between layers. Default: |
required | |
norm
|
Normalization between layers. Default: |
required | |
jk
|
Jumping Knowledge mode. Default: |
required | |
**kwargs
|
Any
|
Additional arguments of the convolution layer
(e.g. |
{}
|
Source code in mlx_graphs/nn/models/basic_gnn.py
from mlx_graphs.nn import GAT · mlx_graphs/nn/models/basic_gnn.py