Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "julia"
directories:
- "/"
- "/docs"
schedule:
interval: "weekly"
groups:
all-julia-packages:
patterns:
- "*"
19 changes: 10 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow-failure == true }}
strategy:
fail-fast: false
matrix:
version:
- "lts" # Long-term support version
- "1" # Latest Release
- "pre" # Pre-release/nightly
os:
- ubuntu-latest
- macOS-latest
Expand All @@ -35,8 +35,12 @@ jobs:
- default
include:
- os: ubuntu-latest
version: "1"
version: "1"
arch: x86
- os: ubuntu-latest
version: "pre"
arch: default
allow-failure: true
steps:
- uses: actions/checkout@v7
- uses: julia-actions/setup-julia@v2
Expand All @@ -57,21 +61,18 @@ jobs:
name: Documentation
runs-on: ubuntu-latest
permissions:
actions: write
contents: write # Required when authenticating with `GITHUB_TOKEN`, not needed when authenticating with SSH deploy keys
pull-requests: read # Required when using `push_preview=true`
statuses: write # Optional, used to report documentation build statuses
steps:
- uses: actions/checkout@v7
- uses: julia-actions/setup-julia@v2
with:
version: '1.10'
version: '1'
- uses: julia-actions/cache@v3
- run: |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
include("docs/make.jl")'
- run: julia --project=docs -e 'using Pkg; Pkg.instantiate()'
- run: julia --project=docs docs/make.jl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
16 changes: 0 additions & 16 deletions .github/workflows/CompatHelper.yml

This file was deleted.

21 changes: 14 additions & 7 deletions .github/workflows/Downgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,34 @@ on:
- main
paths-ignore:
- 'docs/**'
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

# needed to allow julia-actions/cache to delete old caches that it has created
permissions:
actions: write
contents: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
group:
- Core
downgrade_mode: ['alldeps']
julia-version: ['1.10']
julia-version: ['lts']
steps:
- uses: actions/checkout@v7
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v3
- uses: julia-actions/julia-downgrade-compat@v2
# if: ${{ matrix.version == '1.6' }}
with:
skip: Pkg,TOML
mode: ${{ matrix.downgrade_mode }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
ALLOW_RERESOLVE: false
env:
GROUP: ${{ matrix.group }}
11 changes: 5 additions & 6 deletions .github/workflows/IntegrationTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

# needed to allow julia-actions/cache to delete old caches that it has created
permissions:
actions: write
contents: read

jobs:
test:
name: ${{ matrix.package.name }}
Expand All @@ -33,18 +38,12 @@ jobs:
- {user: dfdx, name: Yota}
- {user: JuliaStats, name: StatsFuns}
- {user: JuliaStats, name: LogExpFunctions}
# Diffractor needs to run on Julia nightly
include:
- julia-version: nightly
os: ubuntu-latest
package: {user: JuliaDiff, name: Diffractor}

steps:
- uses: actions/checkout@v7
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
arch: x64
- uses: julia-actions/cache@v3
- uses: julia-actions/julia-buildpkg@v1
- name: Clone Downstream
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/JuliaNightly.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Spell Check

on:
push:
branches: [main]
pull_request:

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

permissions:
contents: read

jobs:
typos:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: crate-ci/typos@v1.51.1
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
[![](https://img.shields.io/badge/docs-main-blue.svg)](https://juliadiff.org/ChainRulesCore.jl/dev)
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliadiff.org/ChainRulesCore.jl/stable)

| ⚠️ The ChainRules project is currently seeking a new primary maintainer ⚠️ |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| See this [Discourse thread](https://discourse.julialang.org/t/chainrules-project-looking-for-a-new-primary-maintainer/115636). We currently have many secondary maintainers and contributors with commit rights, but noone who has committed to leading the efforts. Until this is resolved PRs and issues may not recieve timely response. |
| ⚠️ The ChainRules project is currently seeking a new primary maintainer ⚠️ |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| See this [Discourse thread](https://discourse.julialang.org/t/chainrules-project-looking-for-a-new-primary-maintainer/115636). We currently have many secondary maintainers and contributors with commit rights, but no one who has committed to leading the efforts. Until this is resolved PRs and issues may not receive timely response. |

The ChainRulesCore package provides a light-weight dependency for defining sensitivities for functions in your packages, without you needing to depend on ChainRules itself.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/assets/make_logo.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Pkg: @pkg_str
# For reproducability only dependency this has is Luxor,
# For reproducibility only dependency this has is Luxor,
# and it was created with Luxor v1.6.0
pkg"add Luxor@v1.6"

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rule_author/superpowers/opt_out.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end
That is a fairly reasonable `rrule` for the vast majority of cases.
You might have a custom array type for which you could write a faster rule.
In which case you would do that, by writing a faster, more specific, `rrule`.
But sometimes, it is the case that ADing the (faster, more specific) primal for your custom array type would yeild the faster pullback without you having to write a `rrule` by hand.
But sometimes, it is the case that ADing the (faster, more specific) primal for your custom array type would yield the faster pullback without you having to write a `rrule` by hand.

Consider a summing [`SkewSymmetric` (anti-symmetric)](https://en.wikipedia.org/wiki/Skew-symmetric_matrix) matrix.
The skew symmetric matrix has structural zeros on the diagonal, and off-diagonals are paired with their negation.
Expand Down
10 changes: 5 additions & 5 deletions docs/src/rule_author/tips_for_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ It captures the functionality of both `Zygote.ignore` and `Zygote.dropgrad`.

For example, Zygote does not support mutation, so it will break if you try to store intermediate values as in the following example:
```julia
somes = []
results = []
things = []

function loss(x, y)
some = f(x, y)
result = f(x, y)
thing = g(x)

# log
push!(somes, some)
push!(results, result)
push!(things, thing)

return some + thing
return result + thing
end
```

It is possible to get around this by using the `ignore_derivatives` function
```julia
ignore_derivatives() do
push!(somes, some)
push!(results, result)
push!(things, thing)
end
```
Expand Down
6 changes: 3 additions & 3 deletions docs/src/rule_author/writing_good_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ They can be thought of as a wrapper of the value the computation returns.
In this sense they wrap either a natural or structural tangent.

!!! warning "You should support AbstractThunk inputs even if you don't use thunks"
Unfortunately the AD sytems do not know which rules support thunks and which do not.
Unfortunately the AD systems do not know which rules support thunks and which do not.
So all rules have to; at least if they want to play nicely with arbitrary AD systems.
Luckily it is not hard: much of the time they will duck-type as the object they wrap.
If not, then just add a [`unthunk`](@ref) after the start of your pullback.
(Even when they do duck-type, if they are used multiple times then unthunking at the start will prevent them from being recomputed.)
If you are using [`@thunk`](@ref) and the input is only needed for one of them then the `unthunk` should be in that one.
If not, and you have a bunch of pullbacks you might like to write a little helper `unthunking(f) = x̄ -> f(unthunk(x̄))` that you can wrap your pullback function in before returning it from the `rrule`.
Yes, this is a bit of boiler-plate, and it is unfortunate.
Sadly, it is needed because if the AD wants to benefit it can't get that benifit unless things are not unthunked unnecessarily.
Sadly, it is needed because if the AD wants to benefit it can't get that benefit unless things are not unthunked unnecessarily.
Which eventually allows them in some cases to never be unthunked at all.
There are two ways common things are never unthunked.
One is if the unthunking happens inside a `@thunk` which is never unthunked itself because it is the tangent for a primal input that never has it's tangent queried.
Expand Down Expand Up @@ -226,7 +226,7 @@ function ChainRulesCore.rrule(::typeof(double_it), x)
return double_it(x), double_it_pullback
end
```
Ends up infering a return type of `Any`
Ends up inferring a return type of `Any`
```julia-repl
julia> _, pullback = rrule(double_it, [2.0, 3.0])
([4.0, 6.0], var"#double_it_pullback#8"(Core.Box(var"#double_it_pullback#8"(#= circular reference @-2 =#))))
Expand Down
3 changes: 1 addition & 2 deletions src/accumulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ function Base.showerror(io::IO, err::BadInplaceException)

if err.accumuland == err.returned_value
println(
io,
"Which in this case happenned to be equal. But they are not the same object.",
io, "Which in this case happened to be equal. But they are not the same object."
)
end
end
4 changes: 2 additions & 2 deletions src/projection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ end
(::ProjectTo{T})(dx::Integer) where {T<:Complex{<:AbstractFloat}} = convert(T, dx)

# Other numbers, including e.g. ForwardDiff.Dual and Symbolics.Sym, should pass through.
# We assume (lacking evidence to the contrary) that it is the right subspace of numebers.
# We assume (lacking evidence to the contrary) that it is the right subspace of numbers.
(::ProjectTo{<:Number})(dx::Number) = dx

(project::ProjectTo{<:Real})(dx::Complex) = project(real(dx))
Expand Down Expand Up @@ -275,7 +275,7 @@ end
#####

# Ref
# Note that Ref is mutable. This causes Zygote to represent its structral tangent not as a NamedTuple,
# Note that Ref is mutable. This causes Zygote to represent its structural tangent not as a NamedTuple,
# but as `Ref{Any}((x=val,))`. Here we use a Tangent, there is at present no mutable version, but see
# https://github.com/JuliaDiff/ChainRulesCore.jl/issues/105
function ProjectTo(x::Ref)
Expand Down
4 changes: 2 additions & 2 deletions src/rule_definition_tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ end
"""
_propagator_inputs(n)

Declares properly hygenic inputs for propagation expressions
Declares properly hygienic inputs for propagation expressions
"""
_propagator_inputs(n) = [esc(gensym(Symbol(:Δ, i))) for i in 1:n]

Expand Down Expand Up @@ -487,7 +487,7 @@ end
This allows you to opt-out of an `frule` or an `rrule` by providing a more specific method,
that says to use the AD system to differentiate it.

For example, consider some function `foo(x::AbtractArray)`.
For example, consider some function `foo(x::AbstractArray)`.
In general, you know an efficient and generic way to implement its `rrule`.
You do so, (likely making use of [`ProjectTo`](@ref)).
But it actually turns out that for some `FancyArray` type it is better to let the AD do its
Expand Down
4 changes: 2 additions & 2 deletions src/rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ julia> Δsincosx[2] == -sin(x)
true
```

Note that techically speaking julia does not have multiple output functions, just functions
Note that technically speaking julia does not have multiple output functions, just functions
that return a single output that is iterable, like a `Tuple`.
So this is actually a [`Tangent`](@ref):
```jldoctest frule
Expand Down Expand Up @@ -149,7 +149,7 @@ end
const NO_RRULE_DOC = """
no_rrule

This is an piece of infastructure supporting opting out of [`rrule`](@ref).
This is an piece of infrastructure supporting opting out of [`rrule`](@ref).
It follows the signature for `rrule` exactly.
A collection of type-tuples is stored in its method-table.
If something has this defined, it means that it must having a must also have a `rrule`,
Expand Down
2 changes: 1 addition & 1 deletion src/tangent_arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Notice:
The precedence goes:
`NotImplemented, NoTangent, ZeroTangent, AbstractThunk, Tangent, Any`
Thus each of the @eval loops create most definitions of + and *
defines the combination this type with all types of lower precidence.
defines the combination this type with all types of lower precedence.
This means each eval loops is 1 item smaller than the previous.
==#

Expand Down
Loading
Loading