Skip to content

Commit c8396e4

Browse files
authored
Merge pull request #229 from emsal0/DocsExpand
Append more info to the GNN construction docs
2 parents 40c0bd6 + a50ffab commit c8396e4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/src/basics/layers.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ model = Chain(GCNConv(adj_mat, feat=>h1),
77
GCNConv(adj_mat, h1=>h2, relu))
88
```
99

10-
`GCNConv` is used for layer construction for neural network. The first argument `adj_mat` is the representation of a graph in form of adjacency matrix. The feature dimension in first layer is mapped from `feat` to `h1`. In second layer, `h1` is then mapped to `h2`. Default activation function is given as identity if it is not specified by users.
10+
In the example above, The first argument `adj_mat` is the representation of a graph in form of adjacency matrix. The feature dimension in first layer is mapped from `feat` to `h1`. In second layer, `h1` is then mapped to `h2`. Default activation function is given as identity if it is not specified by users.
11+
12+
The initialization function `GCNConv(...)` constructs a `GCNConv` layer. For most of the layer types in GeometricFlux, a layer can be initialized in at least two ways:
13+
14+
* Initializing *with* a predefined adjacency matrix or `FeaturedGraph`, followed by the other parameters. For most of the layer types, this is for datasets where each input has the same graph structure.
15+
* Initializing *without* an initial graph argument, only supplying the relevant parameters. This allows the layer to accept different graph structures.
16+
17+
# Applying layers
18+
19+
When using GNN layers, the general guidelines are:
20+
21+
* If you pass in a ``n \times d`` matrix of node features, and the layer maps node features ``\mathbb{R}^d \rightarrow \mathbb{R}^k`` then the output will be in matrix with dimensions ``n \times k``. The same ostensibly goes for edge features but as of now no layer type supports outputting new edge features.
22+
* If you pass in a `FeaturedGraph`, the output will be also be a `FeaturedGraph` with modified node (and/or edge) features. Add `node_feature` as the following entry in the Flux chain (or simply call `node_feature()` on the output) if you wish to subsequently convert them to matrix form.
23+
1124

1225
## Customize layers
1326

0 commit comments

Comments
 (0)