Skip to content

Commit

Permalink
build based on 4ed0456
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Feb 12, 2025
1 parent 67361a6 commit 4c09914
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.11.3","generation_timestamp":"2025-02-12T18:17:59","documenter_version":"1.8.1"}}
{"documenter":{"julia_version":"1.11.3","generation_timestamp":"2025-02-12T18:24:09","documenter_version":"1.8.1"}}
6 changes: 3 additions & 3 deletions dev/developer_documentation/developer_tools/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions dev/developer_documentation/internal_docstrings/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/developer_documentation/misc_internals_notes/index.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/known_limitations/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
Mooncake.value_and_gradient!!(rule, foo, [5.0, 4.0])

# output
(4.0, (NoTangent(), [0.0, 1.0]))</code></pre><p><em><strong>The Solution</strong></em></p><p>This is only really a problem for tangent / fdata / rdata generation functionality, such as <code>zero_tangent</code>. As a work-around, AD testing functionality permits users to pass in <code>CoDual</code>s. So if you are testing something involving a pointer, you will need to construct its tangent yourself, and pass a <code>CoDual</code> to e.g. <code>Mooncake.TestUtils.test_rule</code>.</p><p>While pointers tend to be a low-level implementation detail in Julia code, you could in principle actually be interested in differentiating a function of a pointer. In this case, you will not be able to use <code>Mooncake.value_and_gradient!!</code> as this requires the use of <code>zero_tangent</code>. Instead, you will need to use lower-level (internal) functionality, such as <code>Mooncake.__value_and_gradient!!</code>, or use the rule interface directly.</p><p>Honestly, your best bet is just to avoid differentiating functions whose arguments are pointers if you can.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../developer_documentation/internal_docstrings/">« Internal Docstrings</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.8.1 on <span class="colophon-date" title="Wednesday 12 February 2025 18:17">Wednesday 12 February 2025</span>. Using Julia version 1.11.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
(4.0, (NoTangent(), [0.0, 1.0]))</code></pre><p><em><strong>The Solution</strong></em></p><p>This is only really a problem for tangent / fdata / rdata generation functionality, such as <code>zero_tangent</code>. As a work-around, AD testing functionality permits users to pass in <code>CoDual</code>s. So if you are testing something involving a pointer, you will need to construct its tangent yourself, and pass a <code>CoDual</code> to e.g. <code>Mooncake.TestUtils.test_rule</code>.</p><p>While pointers tend to be a low-level implementation detail in Julia code, you could in principle actually be interested in differentiating a function of a pointer. In this case, you will not be able to use <code>Mooncake.value_and_gradient!!</code> as this requires the use of <code>zero_tangent</code>. Instead, you will need to use lower-level (internal) functionality, such as <code>Mooncake.__value_and_gradient!!</code>, or use the rule interface directly.</p><p>Honestly, your best bet is just to avoid differentiating functions whose arguments are pointers if you can.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../developer_documentation/internal_docstrings/">« Internal Docstrings</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.8.1 on <span class="colophon-date" title="Wednesday 12 February 2025 18:24">Wednesday 12 February 2025</span>. Using Julia version 1.11.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Binary file modified dev/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion dev/search_index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dev/tutorial/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
2.0
4.0
6.0</code></pre><p>This returns the correct gradient, but it is very slow because it includes the time taken by Mooncake.jl to compute a differentiation rule for <code>f</code> (see <a href="../understanding_mooncake/rule_system/#Mooncake.jl&#39;s-Rule-System">Mooncake.jl&#39;s Rule System</a>). If you anticipate you will need more than one gradient, it is better to call <a href="https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/stable/api/#DifferentiationInterface.prepare_gradient"><code>DI.prepare_gradient</code></a> on a typical (e.g. random) input first:</p><pre><code class="language-julia hljs">typical_x = rand(3)
prep = DI.prepare_gradient(f, backend, typical_x)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">DifferentiationInterfaceMooncakeExt.MooncakeGradientPrep{Mooncake.Cache{Mooncake.DerivedRule{Tuple{typeof(Main.f), Vector{Float64}}, Tuple{Mooncake.CoDual{typeof(Main.f), NoFData}, Mooncake.CoDual{Vector{Float64}, Vector{Float64}}}, Mooncake.CoDual{Float64, NoFData}, Tuple{Float64}, Tuple{NoRData, NoRData}, false, Val{2}}, Float64, Tuple{NoTangent, Vector{Float64}}}}(Mooncake.Cache{Mooncake.DerivedRule{Tuple{typeof(Main.f), Vector{Float64}}, Tuple{Mooncake.CoDual{typeof(Main.f), NoFData}, Mooncake.CoDual{Vector{Float64}, Vector{Float64}}}, Mooncake.CoDual{Float64, NoFData}, Tuple{Float64}, Tuple{NoRData, NoRData}, false, Val{2}}, Float64, Tuple{NoTangent, Vector{Float64}}}(Mooncake.DerivedRule{Tuple{typeof(Main.f), Vector{Float64}}, Tuple{Mooncake.CoDual{typeof(Main.f), NoFData}, Mooncake.CoDual{Vector{Float64}, Vector{Float64}}}, Mooncake.CoDual{Float64, NoFData}, Tuple{Float64}, Tuple{NoRData, NoRData}, false, Val{2}}(MistyClosure (::Mooncake.CoDual{typeof(Main.f), NoFData}, ::Mooncake.CoDual{Vector{Float64}, Vector{Float64}})::Mooncake.CoDual{Float64, NoFData}-&gt;◌, Base.RefValue{MistyClosures.MistyClosure{Core.OpaqueClosure{Tuple{Float64}, Tuple{NoRData, NoRData}}}}(MistyClosure (::Float64)::Tuple{NoRData, NoRData}-&gt;◌), Val{2}()), 2.1434978701036327, (NoTangent(), [1.9775490292905025, 1.4389915821120063, 1.6101535776991915])))</code></pre><p>The typical input should have the same size and type as the actual inputs we will provide later on. As for the contents of the preparation result, they do not matter. What matters is that it captures everything you need for <code>DI.gradient</code> to be fast:</p><pre><code class="language-julia hljs">DI.gradient(f, prep, backend, x) # fast</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">3-element Vector{Float64}:
prep = DI.prepare_gradient(f, backend, typical_x)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">DifferentiationInterfaceMooncakeExt.MooncakeGradientPrep{Mooncake.Cache{Mooncake.DerivedRule{Tuple{typeof(Main.f), Vector{Float64}}, Tuple{Mooncake.CoDual{typeof(Main.f), NoFData}, Mooncake.CoDual{Vector{Float64}, Vector{Float64}}}, Mooncake.CoDual{Float64, NoFData}, Tuple{Float64}, Tuple{NoRData, NoRData}, false, Val{2}}, Float64, Tuple{NoTangent, Vector{Float64}}}}(Mooncake.Cache{Mooncake.DerivedRule{Tuple{typeof(Main.f), Vector{Float64}}, Tuple{Mooncake.CoDual{typeof(Main.f), NoFData}, Mooncake.CoDual{Vector{Float64}, Vector{Float64}}}, Mooncake.CoDual{Float64, NoFData}, Tuple{Float64}, Tuple{NoRData, NoRData}, false, Val{2}}, Float64, Tuple{NoTangent, Vector{Float64}}}(Mooncake.DerivedRule{Tuple{typeof(Main.f), Vector{Float64}}, Tuple{Mooncake.CoDual{typeof(Main.f), NoFData}, Mooncake.CoDual{Vector{Float64}, Vector{Float64}}}, Mooncake.CoDual{Float64, NoFData}, Tuple{Float64}, Tuple{NoRData, NoRData}, false, Val{2}}(MistyClosure (::Mooncake.CoDual{typeof(Main.f), NoFData}, ::Mooncake.CoDual{Vector{Float64}, Vector{Float64}})::Mooncake.CoDual{Float64, NoFData}-&gt;◌, Base.RefValue{MistyClosures.MistyClosure{Core.OpaqueClosure{Tuple{Float64}, Tuple{NoRData, NoRData}}}}(MistyClosure (::Float64)::Tuple{NoRData, NoRData}-&gt;◌), Val{2}()), 1.4214666494726664, (NoTangent(), [0.11342014810626777, 1.9589041317887748, 1.3548789873472409])))</code></pre><p>The typical input should have the same size and type as the actual inputs we will provide later on. As for the contents of the preparation result, they do not matter. What matters is that it captures everything you need for <code>DI.gradient</code> to be fast:</p><pre><code class="language-julia hljs">DI.gradient(f, prep, backend, x) # fast</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">3-element Vector{Float64}:
2.0
4.0
6.0</code></pre><p>For optimal speed, you can provide storage space for the gradient and call <a href="https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/stable/api/#DifferentiationInterface.gradient%21"><code>DI.gradient!</code></a> instead:</p><pre><code class="language-julia hljs">grad = similar(x)
Expand All @@ -25,4 +25,4 @@
DI.jacobian(h, prep, backend, x)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">3×3 Matrix{Float64}:
-0.118748 0.0 -0.534895
0.0 -0.653644 0.0
-0.534895 0.0 -0.118748</code></pre><h2 id="Mooncake.jl-API"><a class="docs-heading-anchor" href="#Mooncake.jl-API">Mooncake.jl API</a><a id="Mooncake.jl-API-1"></a><a class="docs-heading-anchor-permalink" href="#Mooncake.jl-API" title="Permalink"></a></h2><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>Work in progress.</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Mooncake.jl</a><a class="docs-footer-nextpage" href="../understanding_mooncake/introduction/">Introduction »</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.8.1 on <span class="colophon-date" title="Wednesday 12 February 2025 18:17">Wednesday 12 February 2025</span>. Using Julia version 1.11.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
-0.534895 0.0 -0.118748</code></pre><h2 id="Mooncake.jl-API"><a class="docs-heading-anchor" href="#Mooncake.jl-API">Mooncake.jl API</a><a id="Mooncake.jl-API-1"></a><a class="docs-heading-anchor-permalink" href="#Mooncake.jl-API" title="Permalink"></a></h2><div class="admonition is-warning"><header class="admonition-header">Warning</header><div class="admonition-body"><p>Work in progress.</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Mooncake.jl</a><a class="docs-footer-nextpage" href="../understanding_mooncake/introduction/">Introduction »</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.8.1 on <span class="colophon-date" title="Wednesday 12 February 2025 18:24">Wednesday 12 February 2025</span>. Using Julia version 1.11.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 4c09914

Please sign in to comment.