-
Notifications
You must be signed in to change notification settings - Fork 0
Create the package #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6559e32
rename everything
oxinabox 00d12d1
Basic files created
oxinabox 08f7bf7
Make tests pass
oxinabox 874da9f
make tests pass
oxinabox fd6a675
make docs build
oxinabox 2866f49
break up docs
oxinabox dc116fd
Fix logo in docs
oxinabox 1dd9345
use first not only in tests for 1.0 compat
oxinabox 6c9660b
Apply suggestions from code review
oxinabox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| name = "ChainRulesOverloadGeneration" | ||
| uuid = "f51149dc-2911-5acf-81fc-2076a2a81d4f" | ||
| version = "0.1.0" | ||
|
|
||
| [deps] | ||
| ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" | ||
|
|
||
| [compat] | ||
| ChainRulesCore = "0.9" | ||
|
|
||
| [extras] | ||
| Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
|
||
| [targets] | ||
| test = ["Test"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,16 @@ | ||
| <img src="https://rawcdn.githack.com/JuliaDiff/ChainRulesCore.jl/b0b8dbf26807f8f6bc1a3c073b6720b8d90a8cd4/docs/src/assets/logo.svg" width="256"/> | ||
|
|
||
| # ChainRulesCore | ||
| # ChainRulesOverloadGeneration | ||
|
|
||
| [](https://github.com/JuliaDiff/ChainRulesCore.jl/actions?query=workflow:CI) | ||
| [](https://codecov.io/gh/JuliaDiff/ChainRulesCore.jl) | ||
| [](https://github.com/JuliaDiff/ChainRulesOverloadGeneration.jl/actions?query=workflow:CI) | ||
| [](https://codecov.io/gh/JuliaDiff/ChainRulesOverloadGeneration.jl) | ||
| [](https://github.com/invenia/BlueStyle) | ||
| [](https://github.com/SciML/ColPrac) | ||
| [](https://zenodo.org/badge/latestdoi/199721843) | ||
|
|
||
| **Docs:** | ||
| [](https://juliadiff.org/ChainRulesCore.jl/dev) | ||
| [](https://juliadiff.org/ChainRulesCore.jl/stable) | ||
| [](https://juliadiff.org/ChainRulesOverloadGeneration.jl/dev) | ||
| [](https://juliadiff.org/ChainRulesOverloadGeneration.jl/stable) | ||
|
|
||
| The ChainRulesCore package provides a light-weight dependency for defining sensitivities for functions in your packages, without you needing to depend on ChainRules itself. | ||
|
|
||
| This will allow your package to be used with [ChainRules.jl](https://github.com/JuliaDiff/ChainRules.jl), which aims to provide a variety of common utilities that can be used by downstream automatic differentiation (AD) tools to define and execute forward-, reverse-, and mixed-mode primitives. | ||
|
|
||
| This package is a work in progress; PRs welcome! | ||
| The ChainRulesOverloadGeneration package provides a suite of methods for using [ChainRulesCore.jl](https://github.com/JuliaDiff/ChainRulesCore.jl) rules in operator overloading AD systems. | ||
| It tracks what rules are defined at any point in time, and lets you trigger functions to which can use `@eval` in order to define the matching operator overloads. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,72 +1,32 @@ | ||
| using ChainRulesCore | ||
| using ChainRulesOverloadGeneration | ||
| using ChainRulesCore: ChainRulesCore | ||
| using Documenter | ||
| using DocThemeIndigo | ||
| using Markdown | ||
|
|
||
| DocMeta.setdocmeta!( | ||
| ChainRulesCore, | ||
| :DocTestSetup, | ||
| quote | ||
| using Random | ||
| Random.seed!(0) # frule doctest shows output | ||
|
|
||
| using ChainRulesCore | ||
| # These rules are all actually defined in ChainRules.jl, but we redefine them here to | ||
| # avoid the dependency. | ||
| @scalar_rule(sin(x), cos(x)) # frule and rrule doctest | ||
| @scalar_rule(sincos(x), @setup((sinx, cosx) = Ω), cosx, -sinx) # frule doctest | ||
| @scalar_rule(hypot(x::Real, y::Real), (x / Ω, y / Ω)) # rrule doctest | ||
| end | ||
| ) | ||
|
|
||
| indigo = DocThemeIndigo.install(ChainRulesCore) | ||
| indigo = DocThemeIndigo.install(ChainRulesOverloadGeneration) | ||
|
|
||
| makedocs( | ||
| modules=[ChainRulesCore], | ||
| modules=[ChainRulesOverloadGeneration], | ||
| format=Documenter.HTML( | ||
| prettyurls=false, | ||
| assets=[indigo], | ||
| mathengine=MathJax3( | ||
| Dict( | ||
| :tex => Dict( | ||
| "inlineMath" => [["\$","\$"], ["\\(","\\)"]], | ||
| "tags" => "ams", | ||
| # TODO: remove when using physics package | ||
| "macros" => Dict( | ||
| "ip" => ["{\\left\\langle #1, #2 \\right\\rangle}", 2], | ||
| "Re" => "{\\operatorname{Re}}", | ||
| "Im" => "{\\operatorname{Im}}", | ||
| "tr" => "{\\operatorname{tr}}", | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| sitename="ChainRules", | ||
| authors="Jarrett Revels and other contributors", | ||
| sitename="ChainRules Overload Generation", | ||
| authors="Lyndon White and other contributors", | ||
| pages=[ | ||
| "Introduction" => "index.md", | ||
| "FAQ" => "FAQ.md", | ||
| "Writing Good Rules" => "writing_good_rules.md", | ||
| "Complex Numbers" => "complex.md", | ||
| "Deriving Array Rules" => "arrays.md", | ||
| "Debug Mode" => "debug_mode.md", | ||
| "Gradient Accumulation" => "gradient_accumulation.md", | ||
| "Usage in AD" => [ | ||
| "Overview" => "autodiff/overview.md", | ||
| "Operator Overloading" => "autodiff/operator_overloading.md", | ||
| ], | ||
| "Design" => [ | ||
| "Changing the Primal" => "design/changing_the_primal.md", | ||
| "Many Differential Types" => "design/many_differentials.md", | ||
| "Examples of making AD systems" => [ | ||
| "Forward Mode" => "examples/forward_mode.md", | ||
| "Reverse Mode" => "examples/reverse_mode.md", | ||
| ], | ||
| "API" => "api.md", | ||
| ], | ||
| ], | ||
| strict=true, | ||
| checkdocs=:exports, | ||
| ) | ||
|
|
||
| deploydocs( | ||
| repo = "github.com/JuliaDiff/ChainRulesCore.jl.git", | ||
| repo = "github.com/JuliaDiff/ChainRulesOverloadGeneration.jl.git", | ||
| push_preview=true, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,12 @@ | ||
| # API Documentation | ||
|
|
||
| ## Rules | ||
| ```@autodocs | ||
| Modules = [ChainRulesCore] | ||
| Pages = ["rules.jl"] | ||
| Private = false | ||
| ``` | ||
|
|
||
| ## Rule Definition Tools | ||
| ```@autodocs | ||
| Modules = [ChainRulesCore] | ||
| Pages = ["rule_definition_tools.jl"] | ||
| Private = false | ||
| ``` | ||
|
|
||
| ## Differentials | ||
| ```@autodocs | ||
| Modules = [ChainRulesCore] | ||
| Pages = [ | ||
| "differentials/abstract_zero.jl", | ||
| "differentials/one.jl", | ||
| "differentials/composite.jl", | ||
| "differentials/thunks.jl", | ||
| "differentials/abstract_differential.jl", | ||
| "differentials/notimplemented.jl", | ||
| ] | ||
| Private = false | ||
| ``` | ||
|
|
||
| ## Accumulation | ||
| ```@docs | ||
| add!! | ||
| ChainRulesCore.is_inplaceable_destination | ||
| ``` | ||
|
|
||
| ## Ruleset Loading | ||
| ```@autodocs | ||
| Modules = [ChainRulesCore] | ||
| Modules = [ChainRulesOverloadGeneration] | ||
| Pages = ["ruleset_loading.jl"] | ||
| Private = false | ||
| ``` | ||
|
|
||
| ## Internal | ||
| ```@docs | ||
| ChainRulesCore.AbstractTangent | ||
| ChainRulesCore.debug_mode | ||
| ChainRulesCore.clear_new_rule_hooks! | ||
| ChainRulesOverloadGeneration.clear_new_rule_hooks! | ||
| ``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # ForwardDiffZero | ||
| This is a fairly standard operator overloading-based forward mode AD system. | ||
| It defines a `Dual` part which holds both the primal value, paired with the partial derivative. | ||
| It doesn't handle chunked-mode, or perturbation confusion. | ||
| The overload generation hook in this example is: `define_dual_overload`. | ||
|
|
||
| ````@eval | ||
| using Markdown | ||
| Markdown.parse(""" | ||
| ```julia | ||
| $(read(joinpath(@__DIR__,"../../../test/demos/forwarddiffzero.jl"), String)) | ||
| ``` | ||
| """) | ||
| ```` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # ReverseDiffZero | ||
|
|
||
| This is a fairly standard operator overloading based reverse mode AD system. | ||
| It defines a `Tracked` type which carries the primal value as well as a reference to the tape which is it using, a partially accumulated partial derivative and a `propagate` function that propagates its partial back to its input. | ||
| A perhaps unusual thing about it is how little it carries around its creating operator's inputs. | ||
| That information is all entirely wrapped up in the `propagate` function. | ||
| The overload generation hook in this example is: `define_tracked_overload`. | ||
|
|
||
| ````@eval | ||
| using Markdown | ||
| Markdown.parse(""" | ||
| ```julia | ||
| $(read(joinpath(@__DIR__,"../../../test/demos/reversediffzero.jl"), String)) | ||
| ``` | ||
| """) | ||
| ```` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't actually depend on this yet, so it is pointless to test it?
But I wanted it in there so that the I would relember that this line needs to have
userandrepofields