Skip to content

Commit

Permalink
test on Zygote unconditionally (#55)
Browse files Browse the repository at this point in the history
* test on Zygote unconditionally

* add links to changelog, prepare for release
  • Loading branch information
tpapp authored Dec 20, 2019
1 parent 8b66977 commit 2ed2b18
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Unreleased

## Major cleanup
- test Zygote on all Julia branches [#55](https://github.com/tpapp/LogDensityProblems.jl/pull/55)

## Major cleanup [#54](https://github.com/tpapp/LogDensityProblems.jl/pull/54)

- remove support for ReverseDiff
- replace Flux with Tracker
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LogDensityProblems"
uuid = "6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
authors = ["Tamas K. Papp <[email protected]>"]
version = "0.9.2"
version = "0.10.0"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
5 changes: 1 addition & 4 deletions src/LogDensityProblems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,7 @@ function __init__()
@require DiffResults="163ba53b-c6d8-5494-b064-1a9d43ac40c5" include("DiffResults_helpers.jl")
@require ForwardDiff="f6369f11-7733-5829-9624-2563aa707210" include("AD_ForwardDiff.jl")
@require Tracker="9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" include("AD_Tracker.jl")
if VERSION v"1.1.0"
# workaround for https://github.com/FluxML/Zygote.jl/issues/104
@require Zygote="e88e6eb3-aa80-5325-afca-941959d7151f" include("AD_Zygote.jl")
end
@require Zygote="e88e6eb3-aa80-5325-afca-941959d7151f" include("AD_Zygote.jl")
end

####
Expand Down
30 changes: 12 additions & 18 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using LogDensityProblems, Test, Distributions, TransformVariables
import LogDensityProblems: capabilities, dimension, logdensity
using LogDensityProblems: logdensity_and_gradient, LogDensityOrder

import ForwardDiff, Tracker, TransformVariables, Random
import ForwardDiff, Tracker, TransformVariables, Random, Zygote
using Parameters: @unpack

####
Expand Down Expand Up @@ -122,23 +122,17 @@ end
end
end

if VERSION v"1.1.0"
# cf https://github.com/FluxML/Zygote.jl/issues/104
import Zygote

@testset "AD via Zygote" begin
# cf https://github.com/FluxML/Zygote.jl/issues/271
= TestLogDensity(test_logdensity1)
∇ℓ = ADgradient(:Zygote, ℓ)
@test repr(∇ℓ) == "Zygote AD wrapper for " * repr(ℓ)
@test dimension(∇ℓ) == 3
@test capabilities(∇ℓ) LogDensityOrder(1)
for _ in 1:100
x = randn(3)
@test @inferred(logdensity(∇ℓ, x)) test_logdensity1(x)
@test @inferred(logdensity_and_gradient(∇ℓ, x))
(test_logdensity1(x), test_gradient(x))
end
@testset "AD via Zygote" begin
= TestLogDensity(test_logdensity1)
∇ℓ = ADgradient(:Zygote, ℓ)
@test repr(∇ℓ) == "Zygote AD wrapper for " * repr(ℓ)
@test dimension(∇ℓ) == 3
@test capabilities(∇ℓ) LogDensityOrder(1)
for _ in 1:100
x = randn(3)
@test @inferred(logdensity(∇ℓ, x)) test_logdensity1(x)
@test @inferred(logdensity_and_gradient(∇ℓ, x))
(test_logdensity1(x), test_gradient(x))
end
end

Expand Down

2 comments on commit 2ed2b18

@tpapp
Copy link
Owner Author

@tpapp tpapp commented on 2ed2b18 Dec 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

Release notes:

  • remove support for ReverseDiff (breaking change)
  • replace Flux with Tracker (breaking change)
  • bump Documenter version, minor docs cleanup

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/6962

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.0 -m "<description of version>" 2ed2b18cb454a04528d555936395b1ec3f267832
git push origin v0.10.0

Please sign in to comment.