Skip to content

Commit

Permalink
Update to AutoDiffOperators v0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
oschulz committed Oct 7, 2024
1 parent 3767f31 commit 72e9ab9
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ AdvancedHMC = "0.5, 0.6"
AffineMaps = "0.2.3, 0.3"
ArgCheck = "1, 2.0"
ArraysOfArrays = "0.4, 0.5, 0.6"
AutoDiffOperators = "0.1"
AutoDiffOperators = "0.2"
ChainRulesCore = "0.9.44, 0.10, 1"
ChangesOfVariables = "0.1.1"
Clustering = "0.13, 0.14, 0.15"
Expand Down Expand Up @@ -135,7 +135,7 @@ Measurements = "2"
NamedArrays = "0.9, 0.10"
NestedSamplers = "0.8"
Optim = "0.19,0.20, 0.21, 0.22, 1"
Optimization = "3"
Optimization = "3, 4"
PDMats = "0.9, 0.10, 0.11"
ParallelProcessingTools = "0.4"
Parameters = "0.12, 0.13"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/list_of_algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ BAT sampling algorithm type: [`MCMCSampling`](@ref), MCMC algorithm subtype: [`H

```julia
import AdvancedHMC, ForwardDiff
set_batcontext(ad = ADModule(:ForwardDiff))
set_batcontext(ad = ADSelector(ForwardDiff))
bat_sample(target, MCMCSampling(mcalg = HamiltonianMC()))
```
Requires the [AdvancedHMC](https://github.com/TuringLang/AdvancedHMC.jl) Julia package to be loaded explicitly.
Expand Down Expand Up @@ -160,7 +160,7 @@ using Optim
bat_findmode(target, OptimAlg(optalg = Optim.NelderMead()))

import ForwardDiff
set_batcontext(ad = ADModule(:ForwardDiff))
set_batcontext(ad = ADSelector(ForwardDiff))
bat_findmode(target, OptimAlg(optalg = Optim.LBFGS()))
```

Expand Down
2 changes: 1 addition & 1 deletion examples/dev-internal/test_findmode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ using AutoDiffOperators
b = Optimization.SciMLBase.NoAD()
supertype(typeof(b))

adm = ADModule(:ForwardDiff)
adm = ADSelector(ForwardDiff)

adsel = BAT.get_adselector(context)
supertype(typeof(adsel))
Expand Down
2 changes: 1 addition & 1 deletion examples/paper-example/paper_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Cuba, AdvancedHMC, ForwardDiff
using AutoDiffOperators
#using AHMI

BAT.set_batcontext(ad = ADModule(:ForwardDiff))
BAT.set_batcontext(ad = ADSelector(ForwardDiff))


function log_pdf_poisson::T, k::U) where {T<:Real,U<:Real}
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/test_hierarchical_distribution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AdvancedHMC


@testset "hierarchial_distribution" begin
context = BATContext(ad = ADModule(:ForwardDiff))
context = BATContext(ad = ADSelector(ForwardDiff))

let
primary_dist = NamedTupleDist(
Expand Down
2 changes: 1 addition & 1 deletion test/measures/test_bat_pushfwd_measure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using Optim


@testset "bat_pushfwd_measure" begin
context = BATContext(ad = ADModule(:ForwardDiff))
context = BATContext(ad = ADSelector(ForwardDiff))

@testset "distribution transforms" begin
function test_uv_transformed(target_type::Type{<:Distribution}, source_dist::Distribution)
Expand Down
2 changes: 1 addition & 1 deletion test/optimization/test_mode_estimators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ using Optim, OptimizationOptimJL
end

@testset "Optim.jl - LBFGS" begin
context = BATContext(rng = Philox4x((0, 0)), ad = ADModule(:ForwardDiff))
context = BATContext(rng = Philox4x((0, 0)), ad = ADSelector(ForwardDiff))
# Result Optim.maximize with LBFGS is not type-stable:
test_findmode(posterior, OptimAlg(optalg = LBFGS(), trafo = DoNotTransform()), 0.01, inferred = false, context)

Expand Down
4 changes: 2 additions & 2 deletions test/samplers/mcmc/test_hmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ForwardDiff, Zygote
import AdvancedHMC

@testset "HamiltonianMC" begin
context = BATContext(ad = ADModule(:ForwardDiff))
context = BATContext(ad = ADSelector(ForwardDiff))
objective = NamedTupleDist(a = Normal(1, 1.5), b = MvNormal([-1.0, 2.0], [2.0 1.5; 1.5 3.0]))

shaped_target = @inferred(batmeasure(objective))
Expand Down Expand Up @@ -143,7 +143,7 @@ import AdvancedHMC
@testset "HMC autodiff" begin
posterior = BAT.example_posterior()

for adsel in [ADModule(:ForwardDiff), ADModule(:Zygote)]
for adsel in [ADSelector(ForwardDiff), ADSelector(Zygote)]
@testset "$adsel" begin
context = BATContext(ad = adsel)

Expand Down

0 comments on commit 72e9ab9

Please sign in to comment.