Skip to content

Commit cbbf4bc

Browse files
authored
Merge pull request #2 from nickrobinson251/npr/decide-name
Name package `ChainRulesCore.jl`
2 parents 3a95baa + db9a022 commit cbbf4bc

File tree

13 files changed

+61
-60
lines changed

13 files changed

+61
-60
lines changed

LICENSE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
The AbstractChainRules.jl package is licensed under the MIT "Expat" License:
1+
The ChainRulesCore.jl package is licensed under the MIT "Expat" License:
22

3-
> Copyright (c) 2018: Jarrett Revels.
3+
> Copyright (c) 2018-2019: Jarrett Revels, and other JuliaDiff Contributors:
4+
> https://github.com/JuliaDiff/ChainRulesCore.jl/contributors
45
>
56
> Permission is hereby granted, free of charge, to any person obtaining a copy
67
> of this software and associated documentation files (the "Software"), to deal

Project.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
name = "AbstractChainRules"
1+
name = "ChainRulesCore"
22
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
33
version = "0.1.0"
44

55
[deps]
66
Cassette = "7057c7e9-c182-5462-911a-8362d720325c"
77

8-
98
[compat]
109
Cassette = "^0.2"
1110
julia = "^1.0"

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# AbstractChainRules
1+
# ChainRulesCore
22

3-
[![Travis](https://travis-ci.org/JuliaDiff/AbstractChainRules.jl.svg?branch=master)](https://travis-ci.org/JuliaDiff/AbstractChainRules.jl)
4-
[![Coveralls](https://coveralls.io/repos/github/JuliaDiff/AbstractChainRules.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaDiff/AbstractChainRules.jl?branch=master)
5-
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaDiff.github.io/AbstractChainRules.jl/latest)
3+
[![Travis](https://travis-ci.org/JuliaDiff/ChainRulesCore.jl.svg?branch=master)](https://travis-ci.org/JuliaDiff/ChainRulesCore.jl)
4+
[![Coveralls](https://coveralls.io/repos/github/JuliaDiff/ChainRulesCore.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaDiff/ChainRulesCore.jl?branch=master)
5+
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaDiff.github.io/ChainRulesCore.jl/latest)
66

7-
The AbstractChainRules package provides 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.
7+
The ChainRulesCore package provides 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.
88

99
This package is a WIP; the framework is essentially there, but there are a bunch of TODOs, virtually no tests, etc. PRs welcome! Documentation is incoming, which should help if you'd like to contribute.
1010

@@ -18,4 +18,4 @@ Here are some of the basic goals for the package:
1818

1919
- Control-inverted design: rule authors can fully specify derivatives in a concise manner while naturally allowing the caller to compute only what they need.
2020

21-
The AbstractChainRules source code follows the [YASGuide](https://github.com/jrevels/YASGuide).
21+
The ChainRulesCore source code follows the [YASGuide](https://github.com/jrevels/YASGuide).

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
2+
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
23
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
34

45
[compat]

docs/make.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using AbstractChainRules
1+
using ChainRulesCore
22
using Documenter
33

4-
makedocs(modules=[AbstractChainRules],
5-
sitename="AbstractChainRules",
4+
makedocs(modules=[ChainRulesCore],
5+
sitename="ChainRulesCore",
66
authors="Jarrett Revels and other contributors",
77
pages=["Introduction" => "index.md",
88
"Getting Started" => "getting_started.md",
9-
"AbstractChainRules API Documentation" => "api.md"])
9+
"ChainRulesCore API Documentation" => "api.md"])
1010

11-
deploydocs(repo="github.com/JuliaDiff/AbstractChainRules.jl.git")
11+
deploydocs(repo="github.com/JuliaDiff/ChainRulesCore.jl.git")

docs/src/api.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# AbstractChainRules API Documentation
1+
# ChainRulesCore API Documentation
22

33
```@docs
4-
AbstractChainRules.frule
5-
AbstractChainRules.rrule
6-
AbstractChainRules.AbstractRule
7-
AbstractChainRules.Rule
8-
AbstractChainRules.DNERule
9-
AbstractChainRules.WirtingerRule
10-
AbstractChainRules.accumulate
11-
AbstractChainRules.accumulate!
12-
AbstractChainRules.store!
4+
ChainRulesCore.frule
5+
ChainRulesCore.rrule
6+
ChainRulesCore.AbstractRule
7+
ChainRulesCore.Rule
8+
ChainRulesCore.DNERule
9+
ChainRulesCore.WirtingerRule
10+
ChainRulesCore.accumulate
11+
ChainRulesCore.accumulate!
12+
ChainRulesCore.store!
1313
```
1414

1515
```@docs
16-
AbstractChainRules.AbstractDifferential
17-
AbstractChainRules.extern
18-
AbstractChainRules.Casted
19-
AbstractChainRules.Wirtinger
20-
AbstractChainRules.Thunk
21-
AbstractChainRules.Zero
22-
AbstractChainRules.DNE
23-
AbstractChainRules.One
16+
ChainRulesCore.AbstractDifferential
17+
ChainRulesCore.extern
18+
ChainRulesCore.Casted
19+
ChainRulesCore.Wirtinger
20+
ChainRulesCore.Thunk
21+
ChainRulesCore.Zero
22+
ChainRulesCore.DNE
23+
ChainRulesCore.One
2424
```

docs/src/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
```@meta
2-
DocTestSetup = :(using AbstractChainRules)
3-
CurrentModule = AbstractChainRules
2+
DocTestSetup = :(using ChainRulesCore)
3+
CurrentModule = ChainRulesCore
44
```
55

6-
# AbstractChainRules
6+
# ChainRulesCore
77

8-
Hello! Welcome to AbstractChainRules's documentation.
8+
Hello! Welcome to ChainRulesCore's documentation.
99

10-
For an initial overview of AbstractChainRules, please see the README. Otherwise, feel free to peruse available documentation via the sidebar.
10+
For an initial overview of ChainRulesCore, please see the README. Otherwise, feel free to peruse available documentation via the sidebar.

src/AbstractChainRules.jl renamed to src/ChainRulesCore.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module AbstractChainRules
1+
module ChainRulesCore
22
using Cassette
33
using Base.Broadcast: materialize, materialize!, broadcasted, Broadcasted, broadcastable
44

src/differentials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function mul_wirtinger(a::Wirtinger, b::Wirtinger)
140140
such that we assume the chain rule application is of the form `f_a ∘ f_b`
141141
instead of `f_b ∘ f_a`. However, picking such a convention is likely to
142142
lead to silently incorrect derivatives due to commutativity assumptions
143-
in downstream generic code that deals with the reals. Thus, AbstractChainRules
143+
in downstream generic code that deals with the reals. Thus, ChainRulesCore
144144
makes this operation an error instead.
145145
""")
146146
end

src/rules.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ return that calculated differential value.
1212
For example:
1313
1414
```julia-repl
15-
julia> using AbstractChainRules: frule, rrule, AbstractRule
15+
julia> using ChainRulesCore: frule, rrule, AbstractRule
1616
1717
julia> x, y = rand(2);
1818
@@ -61,7 +61,7 @@ Base.getindex(rule::AbstractRule, i::Integer) = i == 1 ? rule : throw(BoundsErro
6161
"""
6262
accumulate(Δ, rule::AbstractRule, args...)
6363
64-
Return `Δ + rule(args...)` evaluated in a manner that supports AbstractChainRules'
64+
Return `Δ + rule(args...)` evaluated in a manner that supports ChainRulesCore'
6565
various `AbstractDifferential` types.
6666
6767
This method intended to be customizable for specific rules/input types. For
@@ -206,7 +206,7 @@ rules, where e.g. `frule` is used within a `rrule` definition. For example,
206206
broadcasted functions may not themselves be forward-mode *primitives*, but are
207207
often forward-mode *differentiable*.
208208
209-
AbstractChainRules, by design, is decoupled from any specific AD implementation. How,
209+
ChainRulesCore, by design, is decoupled from any specific AD implementation. How,
210210
then, do we know which AD to fall back to when there isn't a primitive defined?
211211
212212
Well, if you're a greedy AD implementation, you can just overload `frule` and/or
@@ -218,12 +218,12 @@ It turns out, Cassette solves this problem nicely by allowing AD authors to
218218
overload the fallbacks w.r.t. their own context. Example using ForwardDiff:
219219
220220
```
221-
using AbstractChainRules, ForwardDiff, Cassette
221+
using ChainRulesCore, ForwardDiff, Cassette
222222
223223
Cassette.@context MyChainRuleCtx
224224
225225
# ForwardDiff, itself, can call `my_frule` instead of
226-
# `frule` to utilize the ForwardDiff-injected AbstractChainRules
226+
# `frule` to utilize the ForwardDiff-injected ChainRulesCore
227227
# infrastructure
228228
my_frule(args...) = Cassette.overdub(MyChainRuleCtx(), frule, args...)
229229
@@ -367,15 +367,15 @@ A convenience macro that generates simple scalar forward or reverse rules using
367367
the provided partial derivatives. Specifically, generates the corresponding
368368
methods for `frule` and `rrule`:
369369
370-
function AbstractChainRules.frule(::typeof(f), x₁::Number, x₂::Number, ...)
370+
function ChainRulesCore.frule(::typeof(f), x₁::Number, x₂::Number, ...)
371371
Ω = f(x₁, x₂, ...)
372372
\$(statement₁, statement₂, ...)
373373
return Ω, (Rule((Δx₁, Δx₂, ...) -> ∂f₁_∂x₁ * Δx₁ + ∂f₁_∂x₂ * Δx₂ + ...),
374374
Rule((Δx₁, Δx₂, ...) -> ∂f₂_∂x₁ * Δx₁ + ∂f₂_∂x₂ * Δx₂ + ...),
375375
...)
376376
end
377377
378-
function AbstractChainRules.rrule(::typeof(f), x₁::Number, x₂::Number, ...)
378+
function ChainRulesCore.rrule(::typeof(f), x₁::Number, x₂::Number, ...)
379379
Ω = f(x₁, x₂, ...)
380380
\$(statement₁, statement₂, ...)
381381
return Ω, (Rule((ΔΩ₁, ΔΩ₂, ...) -> ∂f₁_∂x₁ * ΔΩ₁ + ∂f₂_∂x₁ * ΔΩ₂ + ...),
@@ -410,7 +410,7 @@ is equivalent to:
410410
(∂f₂_∂x₁, ∂f₂_∂x₂, ...),
411411
...)
412412
413-
For examples, see AbstractChainRules' `rules` directory.
413+
For examples, see ChainRulesCore' `rules` directory.
414414
415415
See also: [`frule`](@ref), [`rrule`](@ref), [`AbstractRule`](@ref)
416416
"""
@@ -450,12 +450,12 @@ macro scalar_rule(call, maybe_setup, partials...)
450450
forward_rules = length(forward_rules) == 1 ? forward_rules[1] : Expr(:tuple, forward_rules...)
451451
reverse_rules = length(reverse_rules) == 1 ? reverse_rules[1] : Expr(:tuple, reverse_rules...)
452452
return quote
453-
function AbstractChainRules.frule(::typeof($f), $(inputs...))
453+
function ChainRulesCore.frule(::typeof($f), $(inputs...))
454454
$(esc()) = $call
455455
$(setup_stmts...)
456456
return $(esc()), $forward_rules
457457
end
458-
function AbstractChainRules.rrule(::typeof($f), $(inputs...))
458+
function ChainRulesCore.rrule(::typeof($f), $(inputs...))
459459
$(esc()) = $call
460460
$(setup_stmts...)
461461
return $(esc()), $reverse_rules

0 commit comments

Comments
 (0)