From e10da6bd57efe8219f3ba9797a53fe5816444499 Mon Sep 17 00:00:00 2001 From: Emmanuel Sales Date: Sun, 19 Sep 2021 16:54:39 -0700 Subject: [PATCH 1/4] Append more info to the GNN construction docs --- docs/src/basics/layers.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/src/basics/layers.md b/docs/src/basics/layers.md index 041d7a3ec..16ccbed95 100644 --- a/docs/src/basics/layers.md +++ b/docs/src/basics/layers.md @@ -7,7 +7,20 @@ model = Chain(GCNConv(adj_mat, feat=>h1), GCNConv(adj_mat, h1=>h2, relu)) ``` -`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. +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. + +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: + +* 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. +* Initializing without an initial graph argument, only supplying the relevant parameters. This allows the layer to accept different graph infrastructures. + +# Applying layers + +When using GNN layers, the general guidelines are: + +* 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. +* 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. + ## Customize layers From 79b620f3faa61e4b0f1cc0c1ac8b9434e8985a8e Mon Sep 17 00:00:00 2001 From: Emmanuel Sales Date: Thu, 23 Sep 2021 21:12:56 -0700 Subject: [PATCH 2/4] Update docs/src/basics/layers.md Co-authored-by: Yueh-Hua Tu --- docs/src/basics/layers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/basics/layers.md b/docs/src/basics/layers.md index 16ccbed95..4d0e8bae8 100644 --- a/docs/src/basics/layers.md +++ b/docs/src/basics/layers.md @@ -12,7 +12,7 @@ In the example above, The first argument `adj_mat` is the representation of a gr 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: * 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. -* Initializing without an initial graph argument, only supplying the relevant parameters. This allows the layer to accept different graph infrastructures. +* Initializing *without* an initial graph argument, only supplying the relevant parameters. This allows the layer to accept different graph structures. # Applying layers From cf382181097923e660e9583297823eb20477accf Mon Sep 17 00:00:00 2001 From: Emmanuel Sales Date: Thu, 23 Sep 2021 21:13:05 -0700 Subject: [PATCH 3/4] Update docs/src/basics/layers.md Co-authored-by: Yueh-Hua Tu --- docs/src/basics/layers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/basics/layers.md b/docs/src/basics/layers.md index 4d0e8bae8..91baadd1e 100644 --- a/docs/src/basics/layers.md +++ b/docs/src/basics/layers.md @@ -11,7 +11,7 @@ In the example above, The first argument `adj_mat` is the representation of a gr 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: -* 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. +* 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. * Initializing *without* an initial graph argument, only supplying the relevant parameters. This allows the layer to accept different graph structures. # Applying layers From a50ffaba76eed065aba9665a8457be2736597f36 Mon Sep 17 00:00:00 2001 From: Emmanuel Sales Date: Thu, 23 Sep 2021 21:13:32 -0700 Subject: [PATCH 4/4] Update docs/src/basics/layers.md Co-authored-by: Yueh-Hua Tu --- docs/src/basics/layers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/basics/layers.md b/docs/src/basics/layers.md index 91baadd1e..079e25372 100644 --- a/docs/src/basics/layers.md +++ b/docs/src/basics/layers.md @@ -18,7 +18,7 @@ The initialization function `GCNConv(...)` constructs a `GCNConv` layer. For mos When using GNN layers, the general guidelines are: -* 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. +* 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. * 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.