Skip to content

Commit a2727d3

Browse files
author
Documenter.jl
committed
build based on 7214b6d
1 parent a94416d commit a2727d3

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"documenter":{"julia_version":"1.12.4","generation_timestamp":"2026-01-21T15:49:46","documenter_version":"1.16.1"}}
1+
{"documenter":{"julia_version":"1.12.4","generation_timestamp":"2026-01-21T16:49:47","documenter_version":"1.16.1"}}

previews/PR485/api/index.html

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

previews/PR485/autodiff/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,4 +483,4 @@
483483

484484
<div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../">AdvancedHMC</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><a class="tocitem" href="../">AdvancedHMC.jl</a></li><li><a class="tocitem" href="../get_started/">Get Started</a></li><li class="is-active"><a class="tocitem" href>Automatic Differentiation Backends</a></li><li><a class="tocitem" href="../api/">Detailed API</a></li><li><a class="tocitem" href="../interfaces/">Interfaces</a></li><li><a class="tocitem" href="../news/">News</a></li><li><a class="tocitem" href="../references/">References</a></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 class="is-active"><a href>Automatic Differentiation Backends</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Automatic Differentiation Backends</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/TuringLang/AdvancedHMC.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/TuringLang/AdvancedHMC.jl/blob/main/docs/src/autodiff.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="Gradient-in-AdvancedHMC.jl"><a class="docs-heading-anchor" href="#Gradient-in-AdvancedHMC.jl">Gradient in AdvancedHMC.jl</a><a id="Gradient-in-AdvancedHMC.jl-1"></a><a class="docs-heading-anchor-permalink" href="#Gradient-in-AdvancedHMC.jl" title="Permalink"></a></h1><p>AdvancedHMC.jl supports automatic differentiation using <a href="https://github.com/tpapp/LogDensityProblemsAD.jl"><code>LogDensityProblemsAD</code></a> across various AD backends and allows user-specified gradients. While the default AD backend for AdvancedHMC.jl is ForwardDiff.jl, we can seamlessly change to other backend like Mooncake.jl using various syntax like <code>Hamiltonian(metric, ℓπ, AutoMooncake(; config = nothing))</code>. While some AD backends support syntax like <code>Hamiltonian(metric, ℓπ, Zygote)</code>, <code>Hamiltonian(metric, ℓπ, Val(:Zygote))</code>, we recommend using ADTypes since that would allow you to have more freedom for specifying the AD backend:</p><pre><code class="language-julia hljs">using AdvancedHMC, ADTypes, DifferentiationInterface, Mooncake, Zygote
485485
hamiltonian = Hamiltonian(metric, ℓπ, AutoMooncake(; config=nothing))
486-
hamiltonian = Hamiltonian(metric, ℓπ, AutoZygote())</code></pre><p>In order to use user-specified gradients, please replace ForwardDiff.jl with <code>ℓπ_grad</code> in the <code>Hamiltonian</code> constructor as <code>Hamiltonian(metric, ℓπ, ℓπ_grad)</code>, where the gradient function <code>ℓπ_grad</code> should return a tuple containing both the log-posterior and its gradient, for example <code>ℓπ_grad(x) = (log_posterior, grad)</code>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../get_started/">« Get Started</a><a class="docs-footer-nextpage" href="../api/">Detailed API »</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.16.1 on <span class="colophon-date" title="Wednesday 21 January 2026 15:49">Wednesday 21 January 2026</span>. Using Julia version 1.12.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
486+
hamiltonian = Hamiltonian(metric, ℓπ, AutoZygote())</code></pre><p>In order to use user-specified gradients, please replace ForwardDiff.jl with <code>ℓπ_grad</code> in the <code>Hamiltonian</code> constructor as <code>Hamiltonian(metric, ℓπ, ℓπ_grad)</code>, where the gradient function <code>ℓπ_grad</code> should return a tuple containing both the log-posterior and its gradient, for example <code>ℓπ_grad(x) = (log_posterior, grad)</code>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../get_started/">« Get Started</a><a class="docs-footer-nextpage" href="../api/">Detailed API »</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.16.1 on <span class="colophon-date" title="Wednesday 21 January 2026 16:49">Wednesday 21 January 2026</span>. Using Julia version 1.12.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

previews/PR485/get_started/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,4 +593,4 @@
593593

594594
# Provide your own AbstractIntegrator
595595
integrator = JitteredLeapfrog(0.1, 0.2)
596-
nuts = NUTS(δ; integrator=integrator)</code></pre><h2 id="GPU-Sampling-with-CUDA"><a class="docs-heading-anchor" href="#GPU-Sampling-with-CUDA">GPU Sampling with CUDA</a><a id="GPU-Sampling-with-CUDA-1"></a><a class="docs-heading-anchor-permalink" href="#GPU-Sampling-with-CUDA" title="Permalink"></a></h2><p>There is experimental support for running static HMC on the GPU using CUDA. To do so, the user needs to have <a href="https://github.com/JuliaGPU/CUDA.jl">CUDA.jl</a> installed, ensure the logdensity of the <code>Hamiltonian</code> can be executed on the GPU and that the initial points are a <code>CuArray</code>. A small working example can be found at <code>test/cuda.jl</code>.</p><h2 id="Footnotes"><a class="docs-heading-anchor" href="#Footnotes">Footnotes</a><a id="Footnotes-1"></a><a class="docs-heading-anchor-permalink" href="#Footnotes" title="Permalink"></a></h2><section class="footnotes is-size-7"><ul><li class="footnote" id="footnote-1"><a class="tag is-link" href="#citeref-1">1</a>The Euclidean metric is also known as the mass matrix in the physical perspective. See <a href="@ref hamiltonian-mm">Hamiltonian mass matrix</a> for available metrics.</li><li class="footnote" id="footnote-2"><a class="tag is-link" href="#citeref-2">2</a>About the leapfrog integration scheme: Suppose <span>${\bf x}$</span> and <span>${\bf v}$</span> are the position and velocity of an individual particle respectively; <span>$i$</span> and <span>$i+1$</span> are the indices for time values <span>$t_i$</span> and <span>$t_{i+1}$</span> respectively; <span>$dt = t_{i+1} - t_i$</span> is the time step size (constant and regularly spaced intervals), and <span>${\bf a}$</span> is the acceleration induced on a particle by the forces of all other particles. Furthermore, suppose positions are defined at times <span>$t_i, t_{i+1}, t_{i+2}, \dots $, spaced at constant intervals $dt$</span>, the velocities are defined at halfway times in between, denoted by <span>$t_{i-1/2}, t_{i+1/2}, t_{i+3/2}, \dots $, where $t_{i+1} - t_{i + 1/2} = t_{i + 1/2} - t_i = dt / 2$</span>, and the accelerations <span>${\bf a}$</span> are defined only on integer times, just like the positions. Then the leapfrog integration scheme is given as: <span>$x_{i} = x_{i-1} + v_{i-1/2} dt; \quad v_{i+1/2} = v_{i-1/2} + a_i dt$</span>. For available integrators refer to <a href="../api/#integrator">Integrator</a>.</li><li class="footnote" id="footnote-3"><a class="tag is-link" href="#citeref-3">3</a>On kernels: In the classical HMC approach, during the first step, new values for the momentum variables are randomly drawn from their Gaussian distribution, independently of the current values of the position variables. A Metropolis update is performed during the second step, using Hamiltonian dynamics to provide a new state. For available kernels refer to <a href="../api/#kernel">Kernel</a>.</li></ul></section></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« AdvancedHMC.jl</a><a class="docs-footer-nextpage" href="../autodiff/">Automatic Differentiation Backends »</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.16.1 on <span class="colophon-date" title="Wednesday 21 January 2026 15:49">Wednesday 21 January 2026</span>. Using Julia version 1.12.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
596+
nuts = NUTS(δ; integrator=integrator)</code></pre><h2 id="GPU-Sampling-with-CUDA"><a class="docs-heading-anchor" href="#GPU-Sampling-with-CUDA">GPU Sampling with CUDA</a><a id="GPU-Sampling-with-CUDA-1"></a><a class="docs-heading-anchor-permalink" href="#GPU-Sampling-with-CUDA" title="Permalink"></a></h2><p>There is experimental support for running static HMC on the GPU using CUDA. To do so, the user needs to have <a href="https://github.com/JuliaGPU/CUDA.jl">CUDA.jl</a> installed, ensure the logdensity of the <code>Hamiltonian</code> can be executed on the GPU and that the initial points are a <code>CuArray</code>. A small working example can be found at <code>test/cuda.jl</code>.</p><h2 id="Footnotes"><a class="docs-heading-anchor" href="#Footnotes">Footnotes</a><a id="Footnotes-1"></a><a class="docs-heading-anchor-permalink" href="#Footnotes" title="Permalink"></a></h2><section class="footnotes is-size-7"><ul><li class="footnote" id="footnote-1"><a class="tag is-link" href="#citeref-1">1</a>The Euclidean metric is also known as the mass matrix in the physical perspective. See <a href="@ref hamiltonian-mm">Hamiltonian mass matrix</a> for available metrics.</li><li class="footnote" id="footnote-2"><a class="tag is-link" href="#citeref-2">2</a>About the leapfrog integration scheme: Suppose <span>${\bf x}$</span> and <span>${\bf v}$</span> are the position and velocity of an individual particle respectively; <span>$i$</span> and <span>$i+1$</span> are the indices for time values <span>$t_i$</span> and <span>$t_{i+1}$</span> respectively; <span>$dt = t_{i+1} - t_i$</span> is the time step size (constant and regularly spaced intervals), and <span>${\bf a}$</span> is the acceleration induced on a particle by the forces of all other particles. Furthermore, suppose positions are defined at times <span>$t_i, t_{i+1}, t_{i+2}, \dots $, spaced at constant intervals $dt$</span>, the velocities are defined at halfway times in between, denoted by <span>$t_{i-1/2}, t_{i+1/2}, t_{i+3/2}, \dots $, where $t_{i+1} - t_{i + 1/2} = t_{i + 1/2} - t_i = dt / 2$</span>, and the accelerations <span>${\bf a}$</span> are defined only on integer times, just like the positions. Then the leapfrog integration scheme is given as: <span>$x_{i} = x_{i-1} + v_{i-1/2} dt; \quad v_{i+1/2} = v_{i-1/2} + a_i dt$</span>. For available integrators refer to <a href="../api/#integrator">Integrator</a>.</li><li class="footnote" id="footnote-3"><a class="tag is-link" href="#citeref-3">3</a>On kernels: In the classical HMC approach, during the first step, new values for the momentum variables are randomly drawn from their Gaussian distribution, independently of the current values of the position variables. A Metropolis update is performed during the second step, using Hamiltonian dynamics to provide a new state. For available kernels refer to <a href="../api/#kernel">Kernel</a>.</li></ul></section></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« AdvancedHMC.jl</a><a class="docs-footer-nextpage" href="../autodiff/">Automatic Differentiation Backends »</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.16.1 on <span class="colophon-date" title="Wednesday 21 January 2026 16:49">Wednesday 21 January 2026</span>. Using Julia version 1.12.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

0 commit comments

Comments
 (0)