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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Apply Runic formatter
24375d13a4645398b66909acf82708d9e45a4766
6 changes: 3 additions & 3 deletions .github/workflows/PreCommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
push:
branches:
- main
tags: ["*"]
tags: ['*']
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:
Expand All @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v5
- uses: julia-actions/setup-julia@v2
- uses: julia-actions/cache@v2
- run: julia -e 'using Pkg; Pkg.add("JuliaFormatter")'
- uses: astral-sh/setup-uv@v6
- run: julia -e 'using Pkg; Pkg.add("Runic")'
- uses: astral-sh/setup-uv@v7
- run: uv tool install pre-commit
- run: pre-commit run --all-files --show-diff-on-failure --color always
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ repos:
- id: check-added-large-files
- id: check-merge-conflict
- id: no-commit-to-branch
- repo: "https://github.com/domluna/JuliaFormatter.jl"
rev: "v2.1.6" # or whatever the desired release is
- repo: https://github.com/fredrikekre/runic-pre-commit
rev: v1.0.0
hooks:
- id: "julia-formatter"
- id: runic
fail_fast: true
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ _Only the two maintainers are allowed to approve and merge pull requests._
Feel free to ping them if they do not answer within a week or so.

Apart from the conditions above, this repository follows the [ColPrac](https://github.com/SciML/ColPrac) best practices and [Conventional Commits](https://www.conventionalcommits.org/en/).
Its code is formatted using [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) with [BlueStyle](https://github.com/JuliaDiff/BlueStyle).
Its code is formatted using [Runic.jl](https://github.com/fredrikekre/Runic.jl).
As part of continuous integration, a set of formal tests is run using [pre-commit](https://pre-commit.com/).
We invite you to install pre-commit so that these checks are performed locally before you open or update a pull request.
You can refer to the [dev guide](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/dev/dev_guide/) for details on the package structure and the testing pipeline.
8 changes: 4 additions & 4 deletions DifferentiationInterface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

[![Build Status](https://github.com/JuliaDiff/DifferentiationInterface.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/JuliaDiff/DifferentiationInterface.jl/actions/workflows/Test.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/JuliaDiff/DifferentiationInterface.jl/branch/main/graph/badge.svg?flag=DI)](https://app.codecov.io/gh/JuliaDiff/DifferentiationInterface.jl)
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/JuliaDiff/BlueStyle)
[![code style: runic](https://img.shields.io/badge/code_style-%E1%9A%B1%E1%9A%A2%E1%9A%BE%E1%9B%81%E1%9A%B2-black)](https://github.com/fredrikekre/Runic.jl)
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%27s%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
[![DOI](https://zenodo.org/badge/740973714.svg)](https://zenodo.org/doi/10.5281/zenodo.11092033)

| Package | Docs |
|:----------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| DifferentiationInterface | [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/dev/) |
| Package | Docs |
| :--------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| DifferentiationInterface | [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/dev/) |
| DifferentiationInterfaceTest | [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterfaceTest/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterfaceTest/dev/) |

An interface to various automatic differentiation (AD) backends in Julia.
Expand Down
22 changes: 11 additions & 11 deletions DifferentiationInterface/docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ readme_str = replace(readme_str, "> [!CAUTION]\n> " => "!!! warning\n ")
write(joinpath(@__DIR__, "src", "index.md"), readme_str)

makedocs(;
modules=[DifferentiationInterface],
authors="Guillaume Dalle, Adrian Hill",
sitename="DifferentiationInterface.jl",
format=Documenter.HTML(; assets=["assets/favicon.ico"]),
pages=[
modules = [DifferentiationInterface],
authors = "Guillaume Dalle, Adrian Hill",
sitename = "DifferentiationInterface.jl",
format = Documenter.HTML(; assets = ["assets/favicon.ico"]),
pages = [
"Home" => "index.md",
"Tutorials" => ["tutorials/basic.md", "tutorials/advanced.md"],
"Explanation" => [
Expand All @@ -37,13 +37,13 @@ makedocs(;
"api.md",
"dev_guide.md",
],
plugins=[links],
plugins = [links],
)

deploydocs(;
repo="github.com/JuliaDiff/DifferentiationInterface.jl",
devbranch="main",
dirname="DifferentiationInterface",
tag_prefix="DifferentiationInterface-",
push_preview=false,
repo = "github.com/JuliaDiff/DifferentiationInterface.jl",
devbranch = "main",
dirname = "DifferentiationInterface",
tag_prefix = "DifferentiationInterface-",
push_preview = false,
)
4 changes: 2 additions & 2 deletions DifferentiationInterface/docs/src/assets/logo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ logo = begin

# Define center points and corners of triangle
center = Point(0, 4)
corners = ngon(center, 16, 3, -0.75π / 2; vertices=true)
corners = ngon(center, 16, 3, -0.75π / 2; vertices = true)

# Draw three blended partials
for (i, c) in enumerate(corners)
b = blend(c, 0, center, 50, colors[i], black)
setblend(b)
text("∂", c; valign=:middle, halign=:center, angle=0.68π + 2π / 3 * i)
text("∂", c; valign = :middle, halign = :center, angle = 0.68π + 2π / 3 * i)
end

finish()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
## Pullback

struct ChainRulesPullbackPrepSamePoint{SIG,Y,PB} <: DI.PullbackPrep{SIG}
struct ChainRulesPullbackPrepSamePoint{SIG, Y, PB} <: DI.PullbackPrep{SIG}
_sig::Val{SIG}
y::Y
pb::PB
end

function DI.prepare_pullback_nokwarg(
strict::Val,
f,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant,C};
) where {C}
strict::Val,
f,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant, C}
) where {C}
_sig = DI.signature(f, backend, x, ty, contexts...; strict)
return DI.NoPullbackPrep(_sig)
end

function DI.prepare_pullback_same_point(
f,
prep::DI.NoPullbackPrep,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant,C};
) where {C}
f,
prep::DI.NoPullbackPrep,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant, C}
) where {C}
DI.check_prep(f, prep, backend, x, ty, contexts...)
_sig = DI.signature(f, backend, x, ty, contexts...; strict=DI.is_strict(prep))
_sig = DI.signature(f, backend, x, ty, contexts...; strict = DI.is_strict(prep))
rc = ruleconfig(backend)
y, pb = rrule_via_ad(rc, f, x, map(DI.unwrap, contexts)...)
return ChainRulesPullbackPrepSamePoint(_sig, y, pb)
end

function DI.value_and_pullback(
f,
prep::DI.NoPullbackPrep,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant,C},
) where {C}
f,
prep::DI.NoPullbackPrep,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant, C},
) where {C}
DI.check_prep(f, prep, backend, x, ty, contexts...)
rc = ruleconfig(backend)
y, pb = rrule_via_ad(rc, f, x, map(DI.unwrap, contexts)...)
Expand All @@ -51,13 +51,13 @@ function DI.value_and_pullback(
end

function DI.value_and_pullback(
f,
prep::ChainRulesPullbackPrepSamePoint,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant,C},
) where {C}
f,
prep::ChainRulesPullbackPrepSamePoint,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant, C},
) where {C}
DI.check_prep(f, prep, backend, x, ty, contexts...)
(; y, pb) = prep
tx = map(ty) do dy
Expand All @@ -67,13 +67,13 @@ function DI.value_and_pullback(
end

function DI.pullback(
f,
prep::ChainRulesPullbackPrepSamePoint,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant,C},
) where {C}
f,
prep::ChainRulesPullbackPrepSamePoint,
backend::AutoReverseChainRules,
x,
ty::NTuple,
contexts::Vararg{DI.GeneralizedConstant, C},
) where {C}
DI.check_prep(f, prep, backend, x, ty, contexts...)
(; pb) = prep
tx = map(ty) do dy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ DI.pullback_performance(::AutoDiffractor) = DI.PullbackSlow()
## Pushforward

function DI.prepare_pushforward_nokwarg(
strict::Val, f, backend::AutoDiffractor, x, tx::NTuple
)
strict::Val, f, backend::AutoDiffractor, x, tx::NTuple
)
_sig = DI.signature(f, backend, x, tx; strict)
return DI.NoPushforwardPrep(_sig)
end

function DI.pushforward(
f, prep::DI.NoPushforwardPrep, backend::AutoDiffractor, x, tx::NTuple
)
f, prep::DI.NoPushforwardPrep, backend::AutoDiffractor, x, tx::NTuple
)
DI.check_prep(f, prep, backend, x, tx)
ty = map(tx) do dx
# code copied from Diffractor.jl
Expand All @@ -31,8 +31,8 @@ function DI.pushforward(
end

function DI.value_and_pushforward(
f, prep::DI.NoPushforwardPrep, backend::AutoDiffractor, x, tx::NTuple
)
f, prep::DI.NoPushforwardPrep, backend::AutoDiffractor, x, tx::NTuple
)
DI.check_prep(f, prep, backend, x, tx)
return f(x), DI.pushforward(f, prep, backend, x, tx)
end
Expand Down
Loading
Loading