Skip to content

Commit

Permalink
Restructure docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle committed Mar 18, 2024
1 parent e4ec856 commit b4a9b74
Show file tree
Hide file tree
Showing 7 changed files with 413 additions and 410 deletions.
16 changes: 9 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
const OUTPUT_DIR = joinpath(@__DIR__, "src/generated")

examples = Pair{String,String}[
"Basics" => "autodiff"
"Box model" => "box"
"AutoDiff API" => "autodiff"
"Custom rules" => "custom_rule"
]

Expand Down Expand Up @@ -51,17 +51,19 @@ makedocs(;
pages = [
"Home" => "index.md",
"Examples" => examples,
"API" => "api.md",
"Implementing pullbacks" => "pullbacks.md",
"For developers" => "dev_docs.md",
"Internal API" => "internal_api.md",
"FAQ" => "FAQ.md",
"API reference" => "api.md",
"Advanced" => [
"For developers" => "dev_docs.md",
"Internal API" => "internal_api.md",
]
],
doctest = true,
strict = true,
)

deploydocs(;
repo="github.com/EnzymeAD/Enzyme.jl",
devbranch = "main",
push_preview = true,
devbranch="main",
push_preview=true,
)
4 changes: 2 additions & 2 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# API
# API reference

## Types and constants

Expand All @@ -14,7 +14,7 @@ Modules = [Enzyme, EnzymeCore, EnzymeCore.EnzymeRules, EnzymeTestUtils, Enzyme.A
Order = [:macro, :function]
```

# Documentation
## Documentation

```@autodocs
Modules = [Enzyme, EnzymeCore, EnzymeCore.EnzymeRules, EnzymeTestUtils, Enzyme.API]
Expand Down
394 changes: 394 additions & 0 deletions docs/src/faq.md

Large diffs are not rendered by default.

349 changes: 7 additions & 342 deletions docs/src/index.md

Large diffs are not rendered by default.

47 changes: 0 additions & 47 deletions docs/src/pullbacks.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/autodiff.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# # AutoDiff API
# # Basics

# The goal of this tutorial is to give users already familiar with automatic
# differentiation (AD) an overview
Expand Down
11 changes: 0 additions & 11 deletions lib/EnzymeCore/src/EnzymeCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ Mark a function argument `x` of [`autodiff`](@ref Enzyme.autodiff) as duplicated
auto-differentiate in respect to such arguments, with `dx` acting as an
accumulator for gradients (so ``\\partial f / \\partial x`` will be *added to*)
`∂f_∂x`.
# Note
Enzyme forces `x` and `∂f_∂x` to have the same types when constructing `Duplicated`.
This is not a mathematical requirement, but rather a guardrail to prevent user error.
The memory locations of `x` and `∂f_∂x` are accessed in the same way by the differentiation code, so they should have the same data layout.
Equality of types is an approximation of this condition.
In some ways, type equality is too strict, but in other ways it is not strict enough.
For instance, if `x` and `∂f_∂x` are sparse arrays, their sparsity pattern should be identical, but this is not encoded in the type.
To make sure that `∂f_∂x` has the right data layout, create it with `∂f_∂x = Enzyme.make_zero(x)`.
"""
struct Duplicated{T} <: Annotation{T}
val::T
Expand Down

0 comments on commit b4a9b74

Please sign in to comment.