Skip to content

EpiAwareADTools

Automatic-differentiation safety machinery for the EpiAware modelling stack.

Why EpiAwareADTools?

EpiAwareADTools is the EpiAware org's shared home for AD-safety machinery and AD workarounds. It is deliberately framed as fixes we host while we try to fix things upstream: every entry is documented with the upstream package or issue where it ideally belongs, and each is deleted once that upstream fix lands.

Two families make up the current surface.

  • The tape-strip pair primal and primal_distribution reduce an AD-wrapped scalar or distribution to its underlying primal, keeping a non-differentiable hyperparameter (an integration window, a clamp location) off the AD path on every backend.

  • The AD-safe evaluation hooks cdf_ad_safe, logcdf_ad_safe, ccdf_ad_safe, logccdf_ad_safe, and pdf_ad_safe are extension points a wrapper package overloads for its own component types. Their Gamma methods route through an analytic gamma-CDF derivative that stands in for the differentiability SpecialFunctions.gamma_inc leaves unimplemented.

Per-backend behaviour for ForwardDiff, ReverseDiff, Enzyme, Mooncake, and ChainRulesCore is supplied by package extensions loaded when each backend is present.

Getting started

See the documentation for a full walkthrough.

julia
using EpiAwareADTools, Distributions

# AD-safe Gamma CDF, differentiable in shape/scale on every supported backend.
cdf_ad_safe(Gamma(2.0, 1.0), 3.0)

# Strip an AD wrapper back to its primal value.
primal(3.0)
3.0

Where to learn more

Getting help

For usage questions, ask on the Julia Discourse (the SciML or usage categories) or the epinowcast community forum, our home for epidemiological modelling questions. Please use GitHub issues for bug reports and feature requests only.

Contributing

We welcome contributions and new contributors! This package follows ColPrac and the SciML style.

Supporting and citing

If you would like to support EpiAwareADTools, please star the repository — such metrics help secure future funding.

If you use EpiAwareADTools in your work, please cite it:

bibtex
@software{EpiAwareADTools_jl,
  author       = {Sam Abbott and EpiAware contributors},
  title        = {EpiAwareADTools.jl},
  year         = {2026},
  url          = {https://github.com/EpiAware/EpiAwareADTools.jl}
}

A citable DOI will be added with the first tagged release.

Code of conduct

Please note that the EpiAwareADTools project is released with a Contributor Code of Conduct. By contributing, you agree to abide by its terms.