Skip to content

Commit 1661333

Browse files
Document GatedGraphConv tuple input and heterograph support
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5fac4ae commit 1661333

4 files changed

Lines changed: 36 additions & 2 deletions

File tree

‎GNNLux/docs/src/api/conv.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The table below lists all graph convolutional layers implemented in the *GNNLux.
2424
| [`EdgeConv`](@ref) | | | | ✓ | |
2525
| [`GATConv`](@ref) | | | ✓ | ✓ | ✓ |
2626
| [`GATv2Conv`](@ref) | | | ✓ | ✓ | ✓ |
27-
| [`GatedGraphConv`](@ref) | ✓ | | | | ✓ |
27+
| [`GatedGraphConv`](@ref) | ✓ | | | ✓ | ✓ |
2828
| [`GCNConv`](@ref) | ✓ | ✓ | | ✓ | |
2929
| [`GINConv`](@ref) | ✓ | | | ✓ | ✓ |
3030
| [`GMMConv`](@ref) | | | ✓ | | |

‎GNNLux/src/layers/conv.jl‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,23 @@ where ``\mathbf{h}^{(l)}_i`` denotes the ``l``-th hidden variables passing throu
12191219
- `aggr`: Aggregation operator for the incoming messages (e.g. `+`, `*`, `max`, `min`, and `mean`).
12201220
- `init_weight`: Weights' initializer. Default `glorot_uniform`.
12211221
1222+
# Forward
1223+
1224+
(::GatedGraphConv)(g, x, ps, st) -> (y, st)
1225+
1226+
- `g`: A `GNNGraph`, or a `GNNHeteroGraph` with a single edge type.
1227+
- `x`: A node feature matrix of size `(in, num_nodes)` with `in <= out`,
1228+
or a tuple `(xj, xi)` of source and target node features of sizes `(in_j, num_src_nodes)` and `(in_i, num_dst_nodes)`,
1229+
with `in_j, in_i <= out`.
1230+
- `ps`, `st`: The parameters and state of the layer.
1231+
1232+
Returns the target node features `y` of size `(out, num_dst_nodes)` and the state.
1233+
1234+
When `xj` and `xi` are distinct arrays (e.g. source and target nodes of different types),
1235+
the source nodes have no hidden state evolving in the recursion: their padded features ``[\mathbf{x}_j; \mathbf{0}]``
1236+
are used in place of ``\mathbf{h}^{(l-1)}_j`` at every step, while the target states ``\mathbf{h}^{(l)}_i`` evolve through the GRU.
1237+
If `xj` and `xi` are the same array, the source states evolve as well, as in the homogeneous case.
1238+
12221239
# Examples:
12231240
12241241
```julia

‎GraphNeuralNetworks/docs/src/api/conv.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The table below lists all graph convolutional layers implemented in the *GraphNe
2525
| [`EdgeConv`](@ref) | | | | ✓ | |
2626
| [`GATConv`](@ref) | | | ✓ | ✓ | ✓ |
2727
| [`GATv2Conv`](@ref) | | | ✓ | ✓ | ✓ |
28-
| [`GatedGraphConv`](@ref) | ✓ | | | | ✓ |
28+
| [`GatedGraphConv`](@ref) | ✓ | | | ✓ | ✓ |
2929
| [`GCNConv`](@ref) | ✓ | ✓ | | ✓ | |
3030
| [`GINConv`](@ref) | ✓ | | | ✓ | ✓ |
3131
| [`GMMConv`](@ref) | | | ✓ | | |

‎GraphNeuralNetworks/src/layers/conv.jl‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,23 @@ where ``\mathbf{h}^{(l)}_i`` denotes the ``l``-th hidden variables passing throu
495495
- `aggr`: Aggregation operator for the incoming messages (e.g. `+`, `*`, `max`, `min`, and `mean`).
496496
- `init`: Weight initialization function.
497497
498+
# Forward
499+
500+
(::GatedGraphConv)(g, x) -> AbstractMatrix
501+
502+
- `g`: A `GNNGraph`, or a `GNNHeteroGraph` with a single edge type (e.g. within a [`HeteroGraphConv`](@ref)).
503+
- `x`: A node feature matrix of size `(in, num_nodes)` with `in <= out`,
504+
or a tuple `(xj, xi)` of source and target node features of sizes `(in_j, num_src_nodes)` and `(in_i, num_dst_nodes)`,
505+
with `in_j, in_i <= out`.
506+
507+
Returns the target node features of size `(out, num_dst_nodes)`.
508+
509+
When `xj` and `xi` are distinct arrays (e.g. source and target nodes of different types),
510+
the source nodes have no hidden state evolving in the recursion: their padded features ``[\mathbf{x}_j; \mathbf{0}]``
511+
are used in place of ``\mathbf{h}^{(l-1)}_j`` at every step, while the target states ``\mathbf{h}^{(l)}_i`` evolve through the GRU.
512+
If `xj` and `xi` are the same array (as passed by [`HeteroGraphConv`](@ref) for relations whose source and target
513+
node types coincide), the source states evolve as well, as in the homogeneous case.
514+
498515
# Examples:
499516
500517
```julia

0 commit comments

Comments
 (0)