Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Update docs to be compatible with ChainRules and document about using…
Browse files Browse the repository at this point in the history
… ChainRulesCore
  • Loading branch information
oxinabox committed Jul 2, 2021
1 parent 00ef4ac commit 970893a
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1'
version: '1.6'
- run: |
julia --project=docs -e '
using Pkg
Expand Down
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
*.pdf
*.DS_Store
*.jl.cov
*.jl.*.cov
*.jl.mem
*.pdf
*.DS_Store
Manifest.toml
docs/build/
docs/build
docs/site
docs/src/assets/chainrules.css
docs/src/assets/indigo.css
.vscode/settings.json
4 changes: 3 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[deps]
DocThemeIndigo = "8bac0ac5-51bf-41f9-885e-2bf1ac2bec5f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Nabla = "49c96f43-aa6d-5a04-a506-44c7070ebe78"

[compat]
Documenter = "~0.19"
Documenter = "0.27"
25 changes: 13 additions & 12 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
using Documenter, Nabla
using Documenter
using DocThemeIndigo
using Nabla

const indigo = DocThemeIndigo.install(Nabla)
makedocs(
modules=[Nabla],
format=:html,
format=Documenter.HTML(
prettyurls=false,
assets=[indigo],
),
sitename="Nabla.jl",
authors="Invenia Labs",
pages=[
"Home" => "index.md",
"API" => "pages/api.md",
"Custom Sensitivities" => "pages/custom.md",
"Details" => "pages/autodiff.md",
],
sitename="Nabla.jl",
authors="Invenia Labs",
assets=[
"assets/invenia.css",
],
)


deploydocs(
repo = "github.com/invenia/Nabla.jl.git",
julia = "1.0",
target = "build",
deps = nothing,
make = nothing,
)
push_preview=true,
)
75 changes: 0 additions & 75 deletions docs/src/assets/invenia.css

This file was deleted.

Binary file added docs/src/assets/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion docs/src/pages/custom.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# Custom Sensitivities
# Custom Sensitivities

!!! note "Prefer to use ChainRulesCore to define custom sensitivities"
Nabla supports the use of [ChainRulesCore](http://www.juliadiff.org/ChainRulesCore.jl/stable/) to define custom sensitivities.
It is preferred to define the custom sensitivities using `ChainRulesCore.rrule` as they will work for many AD systems, not just Nabla.
**It is also much easier, than the Nabla specific way**.
These sensitivities can be added in your own package, or for Base/StdLib functions they can be added to [ChainRules.jl](https://github.com/JuliaDiff/ChainRules.jl/).
To define custom sensitivities using ChainRulesCore, define a `ChainRulesCore.rrule(f, args...; kwargs...)`.
See the [ChainRules project's documentation for more information](https://www.juliadiff.org/ChainRulesCore.jl/stable/).
**If you are defining your custom sensitivities using ChainRulesCore then you do not need to read this page**, and can consider it as documenting a legacy feature.

This page exists to describe how Nabla works, and how sensitivities can be directly defined for Nabla.
Defining sensitivities this way does not make them accessible to other AD systems, but does let you do things that directly depend on how Nabla works.
It allows for specific definitions of sensitivities that are only defined for Nabla (which might work differently to more generic definitions defined for all AD).

# Legacy Method

Part of the power of Nabla is its extensibility, specifically in the form of defining
custom sensitivities for functions.
Expand Down

0 comments on commit 970893a

Please sign in to comment.