-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Documenter.jl
committed
Nov 3, 2024
1 parent
8c30d53
commit 1590e01
Showing
40 changed files
with
2,136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-11-03T22:16:24","documenter_version":"1.7.0"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Basic · GraphNeuralNetworks.jl</title><meta name="title" content="Basic · GraphNeuralNetworks.jl"/><meta property="og:title" content="Basic · GraphNeuralNetworks.jl"/><meta property="twitter:title" content="Basic · GraphNeuralNetworks.jl"/><meta name="description" content="Documentation for GraphNeuralNetworks.jl."/><meta property="og:description" content="Documentation for GraphNeuralNetworks.jl."/><meta property="twitter:description" content="Documentation for GraphNeuralNetworks.jl."/><script data-outdated-warner src="../../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../search_index.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../../"><img src="../../assets/logo.svg" alt="GraphNeuralNetworks.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../../">GraphNeuralNetworks.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><span class="tocitem">Monorepo</span><ul><li><a class="tocitem" href="../../">Home</a></li><li><a class="tocitem" href="../../dev/">Developer guide</a></li><li><a class="tocitem" href="../../gsoc/">Google Summer of Code</a></li></ul></li><li><span class="tocitem">GraphNeuralNetworks.jl</span><ul><li><a class="tocitem" href="../../home/">Home</a></li><li><a class="tocitem" href="../../models/">Models</a></li></ul></li><li><span class="tocitem">API Reference</span><ul><li class="is-active"><a class="tocitem" href>Basic</a><ul class="internal"><li><a class="tocitem" href="#Index"><span>Index</span></a></li><li><a class="tocitem" href="#Docs"><span>Docs</span></a></li></ul></li><li><a class="tocitem" href="../conv/">Convolutional layers</a></li><li><a class="tocitem" href="../pool/">Pooling layers</a></li><li><a class="tocitem" href="../temporalconv/">Temporal Convolutional layers</a></li><li><a class="tocitem" href="../heteroconv/">Hetero Convolutional layers</a></li><li><a class="tocitem" href="../samplers/">Samplers</a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">API Reference</a></li><li class="is-active"><a href>Basic</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Basic</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/JuliaGraphs/GraphNeuralNetworks.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/blob/master/GraphNeuralNetworks/docs/src/api/basic.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Basic-Layers"><a class="docs-heading-anchor" href="#Basic-Layers">Basic Layers</a><a id="Basic-Layers-1"></a><a class="docs-heading-anchor-permalink" href="#Basic-Layers" title="Permalink"></a></h1><h2 id="Index"><a class="docs-heading-anchor" href="#Index">Index</a><a id="Index-1"></a><a class="docs-heading-anchor-permalink" href="#Index" title="Permalink"></a></h2><ul><li><a href="#GraphNeuralNetworks.DotDecoder"><code>GraphNeuralNetworks.DotDecoder</code></a></li><li><a href="#GraphNeuralNetworks.GNNChain"><code>GraphNeuralNetworks.GNNChain</code></a></li><li><a href="#GraphNeuralNetworks.GNNLayer"><code>GraphNeuralNetworks.GNNLayer</code></a></li><li><a href="#GraphNeuralNetworks.WithGraph"><code>GraphNeuralNetworks.WithGraph</code></a></li></ul><h2 id="Docs"><a class="docs-heading-anchor" href="#Docs">Docs</a><a id="Docs-1"></a><a class="docs-heading-anchor-permalink" href="#Docs" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="GraphNeuralNetworks.DotDecoder" href="#GraphNeuralNetworks.DotDecoder"><code>GraphNeuralNetworks.DotDecoder</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">DotDecoder()</code></pre><p>A graph neural network layer that for given input graph <code>g</code> and node features <code>x</code>, returns the dot product <code>x_i ⋅ xj</code> on each edge. </p><p><strong>Examples</strong></p><pre><code class="language-julia-repl hljs">julia> g = rand_graph(5, 6) | ||
GNNGraph: | ||
num_nodes = 5 | ||
num_edges = 6 | ||
|
||
julia> dotdec = DotDecoder() | ||
DotDecoder() | ||
|
||
julia> dotdec(g, rand(2, 5)) | ||
1×6 Matrix{Float64}: | ||
0.345098 0.458305 0.106353 0.345098 0.458305 0.106353</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/blob/867975d1c982f24cb9c6831a5709cdff6bcb895b/GraphNeuralNetworks/src/layers/basic.jl#L187-L209">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="GraphNeuralNetworks.GNNChain" href="#GraphNeuralNetworks.GNNChain"><code>GraphNeuralNetworks.GNNChain</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">GNNChain(layers...) | ||
GNNChain(name = layer, ...)</code></pre><p>Collects multiple layers / functions to be called in sequence on given input graph and input node features. </p><p>It allows to compose layers in a sequential fashion as <code>Flux.Chain</code> does, propagating the output of each layer to the next one. In addition, <code>GNNChain</code> handles the input graph as well, providing it as a first argument only to layers subtyping the <a href="#GraphNeuralNetworks.GNNLayer"><code>GNNLayer</code></a> abstract type. </p><p><code>GNNChain</code> supports indexing and slicing, <code>m[2]</code> or <code>m[1:end-1]</code>, and if names are given, <code>m[:name] == m[1]</code> etc.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl hljs">julia> using Flux, GraphNeuralNetworks | ||
|
||
julia> m = GNNChain(GCNConv(2=>5), | ||
BatchNorm(5), | ||
x -> relu.(x), | ||
Dense(5, 4)) | ||
GNNChain(GCNConv(2 => 5), BatchNorm(5), #7, Dense(5 => 4)) | ||
|
||
julia> x = randn(Float32, 2, 3); | ||
|
||
julia> g = rand_graph(3, 6) | ||
GNNGraph: | ||
num_nodes = 3 | ||
num_edges = 6 | ||
|
||
julia> m(g, x) | ||
4×3 Matrix{Float32}: | ||
-0.795592 -0.795592 -0.795592 | ||
-0.736409 -0.736409 -0.736409 | ||
0.994925 0.994925 0.994925 | ||
0.857549 0.857549 0.857549 | ||
|
||
julia> m2 = GNNChain(enc = m, | ||
dec = DotDecoder()) | ||
GNNChain(enc = GNNChain(GCNConv(2 => 5), BatchNorm(5), #7, Dense(5 => 4)), dec = DotDecoder()) | ||
|
||
julia> m2(g, x) | ||
1×6 Matrix{Float32}: | ||
2.90053 2.90053 2.90053 2.90053 2.90053 2.90053 | ||
|
||
julia> m2[:enc](g, x) == m(g, x) | ||
true</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/blob/867975d1c982f24cb9c6831a5709cdff6bcb895b/GraphNeuralNetworks/src/layers/basic.jl#L54-L105">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="GraphNeuralNetworks.GNNLayer" href="#GraphNeuralNetworks.GNNLayer"><code>GraphNeuralNetworks.GNNLayer</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">abstract type GNNLayer end</code></pre><p>An abstract type from which graph neural network layers are derived.</p><p>See also <a href="#GraphNeuralNetworks.GNNChain"><code>GNNChain</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/blob/867975d1c982f24cb9c6831a5709cdff6bcb895b/GraphNeuralNetworks/src/layers/basic.jl#L1-L7">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="GraphNeuralNetworks.WithGraph" href="#GraphNeuralNetworks.WithGraph"><code>GraphNeuralNetworks.WithGraph</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">WithGraph(model, g::GNNGraph; traingraph=false)</code></pre><p>A type wrapping the <code>model</code> and tying it to the graph <code>g</code>. In the forward pass, can only take feature arrays as inputs, returning <code>model(g, x...; kws...)</code>.</p><p>If <code>traingraph=false</code>, the graph's parameters won't be part of the <code>trainable</code> parameters in the gradient updates.</p><p><strong>Examples</strong></p><pre><code class="language-julia hljs">g = GNNGraph([1,2,3], [2,3,1]) | ||
x = rand(Float32, 2, 3) | ||
model = SAGEConv(2 => 3) | ||
wg = WithGraph(model, g) | ||
# No need to feed the graph to `wg` | ||
@assert wg(x) == model(g, x) | ||
|
||
g2 = GNNGraph([1,1,2,3], [2,4,1,1]) | ||
x2 = rand(Float32, 2, 4) | ||
# WithGraph will ignore the internal graph if fed with a new one. | ||
@assert wg(g2, x2) == model(g2, x2)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/JuliaGraphs/GraphNeuralNetworks.jl/blob/867975d1c982f24cb9c6831a5709cdff6bcb895b/GraphNeuralNetworks/src/layers/basic.jl#L14-L39">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../../models/">« Models</a><a class="docs-footer-nextpage" href="../conv/">Convolutional layers »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Sunday 3 November 2024 22:16">Sunday 3 November 2024</span>. Using Julia version 1.10.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
Oops, something went wrong.