Skip to content

Commit

Permalink
Merge in master
Browse files Browse the repository at this point in the history
  • Loading branch information
wt committed Dec 9, 2020
2 parents 32a42dd + 2dab3ab commit e98519b
Show file tree
Hide file tree
Showing 19 changed files with 743 additions and 175 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI
on:
push:
branches: [master]
tags: [v*]
pull_request:
schedule:
- cron: "0 0 * * *" # run on default branch every night at midnight UTC

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.0'
- '1'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x86
- x64
# 32-bit Julia binaries are not available on macOS
exclude:
- os: macOS-latest
arch: x86
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
parallel: true
path-to-lcov: lcov.info

finish:
name: Coveralls Finished
needs: test
runs-on: ubuntu-latest
steps:
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
48 changes: 48 additions & 0 deletions .github/workflows/JuliaNightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# CI for Julia nightly, separate workflow to avoid failing CI badge on nightly fail
name: JuliaNightly
on:
push:
branches: [master]
tags: [v*]
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
test:
name: ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x86
- x64
# 32-bit Julia binaries are not available on macOS
exclude:
- os: macOS-latest
arch: x86
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ChainRules"
uuid = "082447d4-558c-5d27-93f4-14fc19e9eca2"
version = "0.7.34"
version = "0.7.37"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand All @@ -13,10 +13,10 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
ChainRulesCore = "0.9.16"
ChainRulesTestUtils = "0.5"
ChainRulesCore = "0.9.21"
ChainRulesTestUtils = "0.5.1"
Compat = "3"
FiniteDifferences = "0.11"
FiniteDifferences = "0.11.4"
Reexport = "0.2"
Requires = "0.5.2, 1"
julia = "1"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

# ChainRules

[![CI](https://github.com/JuliaDiff/ChainRules.jl/workflows/CI/badge.svg?branch=master)](https://github.com/JuliaDiff/ChainRules.jl/actions?query=workflow%3ACI)
[![Travis](https://travis-ci.org/JuliaDiff/ChainRules.jl.svg?branch=master)](https://travis-ci.org/JuliaDiff/ChainRules.jl)
[![Codecov](https://codecov.io/gh/JuliaDiff/ChainRules.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaDiff/ChainRules.jl)
[![Coveralls](https://coveralls.io/repos/github/JuliaDiff/ChainRules.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaDiff/ChainRules.jl?branch=master)
[![PkgEval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/C/ChainRules.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html)
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
Expand Down
8 changes: 7 additions & 1 deletion src/ChainRules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ include("rulesets/Statistics/statistics.jl")
include("rulesets/LinearAlgebra/utils.jl")
include("rulesets/LinearAlgebra/blas.jl")
include("rulesets/LinearAlgebra/dense.jl")
include("rulesets/LinearAlgebra/norm.jl")
include("rulesets/LinearAlgebra/structured.jl")
include("rulesets/LinearAlgebra/symmetric.jl")
include("rulesets/LinearAlgebra/factorization.jl")

include("rulesets/Random/random.jl")
Expand All @@ -56,8 +58,12 @@ function __init__()
include("rulesets/packages/NaNMath.jl")
end

# Note: drop SpecialFunctions dependency in next breaking release
# https://github.com/JuliaDiff/ChainRules.jl/issues/319
@require SpecialFunctions="276daf66-3868-5448-9aa4-cd146d93841b" begin
include("rulesets/packages/SpecialFunctions.jl")
if !isdefined(SpecialFunctions, :ChainRulesCore)
include("rulesets/packages/SpecialFunctions.jl")
end
end
end

Expand Down
63 changes: 63 additions & 0 deletions src/rulesets/Base/nondiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,69 @@
@non_differentiable ==(::Any, ::Any)
@non_differentiable ===(::Any, ::Any)


@non_differentiable Bool(::Any)

@non_differentiable accumulate(::Any, ::AbstractArray{Bool})
@non_differentiable accumulate!(::Any, ::Any, ::AbstractArray{Bool})
@non_differentiable cat(::AbstractArray{Bool}...)
@non_differentiable circcopy!(::Any, ::AbstractArray{Bool})
@non_differentiable circshift(::AbstractArray{Bool}, ::Any)
@non_differentiable circshift!(::Any, ::AbstractArray{Bool}, ::Any)
@non_differentiable circshift!(::AbstractArray{Bool}, ::Any)
@non_differentiable conj(::AbstractArray{Bool})
@non_differentiable conj!(::AbstractArray{Bool})
@non_differentiable cumprod(::AbstractArray{Bool})
@non_differentiable cumprod!(::Any, ::AbstractArray{Bool})
@non_differentiable cumsum(::AbstractArray{Bool})
@non_differentiable cumsum!(::Any, ::AbstractArray{Bool})
@non_differentiable diff(::AbstractArray{Bool})
@non_differentiable dropdims(::AbstractArray{Bool})
@non_differentiable eachcol(::AbstractArray{Bool})
@non_differentiable eachrow(::AbstractArray{Bool})
@non_differentiable eachslice(::AbstractArray{Bool})
@non_differentiable fill(::AbstractArray{Bool})
@non_differentiable fill!(::AbstractArray, ::Any)
@non_differentiable findprev(::AbstractArray{Bool}, ::Any)
@non_differentiable findprev(::Any, ::AbstractArray{Bool}, ::Any)
@non_differentiable getindex(::AbstractArray{Bool}, ::Any...)
@non_differentiable hcat(::AbstractArray{Bool}...)
@non_differentiable hvcat(::Any, ::AbstractArray{Bool}...)
@non_differentiable isperm(::AbstractArray{Bool})
@non_differentiable invperm(::AbstractArray{Bool})
@non_differentiable invpermute!(::Any, ::AbstractArray{Bool})
@non_differentiable mapslices(::Any, ::AbstractArray{Bool})
@non_differentiable Matrix(::AbstractArray{Bool})
@non_differentiable ndims(::AbstractArray{Bool})
@non_differentiable parent(::AbstractArray{Bool})
@non_differentiable parentindices(::AbstractArray{Bool})
@non_differentiable permute!(::AbstractArray{Bool}, ::Any)
@non_differentiable permutedims(::AbstractArray{Bool})
@non_differentiable permutedims(::AbstractArray{Bool}, ::Any)
@non_differentiable promote_shape(::AbstractArray{Bool}, ::Any)
@non_differentiable repeat(::AbstractArray{Bool}, ::Any...)
@non_differentiable reshape(::AbstractArray{Bool}, ::Any...)
@non_differentiable reverse(::AbstractArray{Bool}, ::Any...)
@non_differentiable reverse!(::AbstractArray{Bool}, ::Any...)
@non_differentiable reverseind(::AbstractArray{Bool}, ::Any)
@non_differentiable rot180(::AbstractArray{Bool})
@non_differentiable rot180(::AbstractArray{Bool}, ::Any)
@non_differentiable rotl90(::AbstractArray{Bool})
@non_differentiable rotl90(::AbstractArray{Bool}, ::Any)
@non_differentiable rotr90(::AbstractArray{Bool})
@non_differentiable rotr90(::AbstractArray{Bool}, ::Any)
@non_differentiable selectdim(::AbstractArray{Bool}, ::Any, ::Any)
@non_differentiable setindex!(::AbstractArray{Bool}, ::Any, ::Any)
@non_differentiable similar(::AbstractArray{Bool}, ::Any...)
@non_differentiable stride(::AbstractArray{Bool}, ::Any)
@non_differentiable strides(::AbstractArray{Bool})
@non_differentiable vcat(::AbstractArray{Bool}...)
@non_differentiable vec(::AbstractArray{Bool})
@non_differentiable Vector(::AbstractArray{Bool})

@non_differentiable Array(::AbstractArray{Bool})
@non_differentiable IndexStyle(::AbstractArray{Bool})

@non_differentiable abspath(::AbstractString)
@non_differentiable abspath(::AbstractString, ::AbstractString)
@non_differentiable all(::Any)
Expand Down
24 changes: 0 additions & 24 deletions src/rulesets/LinearAlgebra/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,27 +239,3 @@ function rrule(::typeof(pinv), A::AbstractMatrix{T}; kwargs...) where {T}
end
return Y, pinv_pullback
end

#####
##### `norm`
#####

function rrule(::typeof(norm), A::AbstractArray{<:Real}, p::Real=2)
y = norm(A, p)
function norm_pullback(ȳ)
u = y^(1-p)
∂A = @thunk.* u .* abs.(A).^p ./ A
∂p = @thunk* (u * sum(a->abs(a)^p * log(abs(a)), A) - y * log(y)) / p
(NO_FIELDS, ∂A, ∂p)
end
return y, norm_pullback
end

function rrule(::typeof(norm), x::Real, p::Real=2)
function norm_pullback(ȳ)
∂x = @thunk* sign(x)
∂p = @thunk zero(x) # TODO: should this be Zero()?
(NO_FIELDS, ∂x, ∂p)
end
return norm(x, p), norm_pullback
end
Loading

0 comments on commit e98519b

Please sign in to comment.