Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore compat with ADTypes v0.2. Make AutoTapir export conditional. #2252

Merged
merged 2 commits into from
Jun 4, 2024
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
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ AdvancedPS = "576499cb-2369-40b2-a588-c64705576edc"
AdvancedVI = "b5ca4192-6429-45e5-a2d9-87aec30a685c"
BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c"
Expand Down Expand Up @@ -48,7 +49,7 @@ TuringDynamicHMCExt = "DynamicHMC"
TuringOptimExt = "Optim"

[compat]
ADTypes = "1"
ADTypes = "0.2, 1"
AbstractMCMC = "5.2"
Accessors = "0.1"
AdvancedHMC = "0.3.0, 0.4.0, 0.5.2, 0.6"
Expand All @@ -63,6 +64,7 @@ DistributionsAD = "0.6"
DocStringExtensions = "0.8, 0.9"
DynamicHMC = "3.4"
DynamicPPL = "0.27.1"
Compat = "4.15.0"
EllipticalSliceSampling = "0.5, 1, 2"
ForwardDiff = "0.10.3"
Libtask = "0.7, 0.8"
Expand Down
7 changes: 6 additions & 1 deletion src/Turing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using DistributionsAD, Bijectors, StatsFuns, SpecialFunctions
using Statistics, LinearAlgebra
using Libtask
@reexport using Distributions, MCMCChains, Libtask, AbstractMCMC, Bijectors
using Compat: pkgversion

import AdvancedVI
using DynamicPPL: DynamicPPL, LogDensityFunction
Expand Down Expand Up @@ -107,7 +108,6 @@ export @model, # modelling
AutoReverseDiff,
AutoZygote,
AutoTracker,
AutoTapir,

setprogress!, # debugging

Expand Down Expand Up @@ -144,6 +144,11 @@ export @model, # modelling
MAP,
MLE

# AutoTapir is only supported by ADTypes v1.0 and above.
@static if VERSION >= v"1.10" && pkgversion(ADTypes) >= v"1"
export AutoTapir
end

if !isdefined(Base, :get_extension)
using Requires
end
Expand Down
9 changes: 7 additions & 2 deletions src/essential/Essential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using Bijectors: PDMatDistribution
using AdvancedVI
using StatsFuns: logsumexp, softmax
@reexport using DynamicPPL
using ADTypes: ADTypes, AutoForwardDiff, AutoTracker, AutoReverseDiff, AutoZygote, AutoTapir
using ADTypes: ADTypes, AutoForwardDiff, AutoTracker, AutoReverseDiff, AutoZygote

import AdvancedPS

Expand Down Expand Up @@ -39,9 +39,14 @@ export @model,
AutoTracker,
AutoZygote,
AutoReverseDiff,
AutoTapir,
value,
@logprob_str,
@prob_str

# AutoTapir is only supported by ADTypes v1.0 and above.
@static if VERSION >= v"1.10" && pkgversion(ADTypes) >= v"1"
using ADTypes: AutoTapir
export AutoTapir
end

end # module
Loading