File tree Expand file tree Collapse file tree 5 files changed +24
-0
lines changed Expand file tree Collapse file tree 5 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,11 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
24
24
25
25
[weakdeps ]
26
26
MCMCChains = " c7f686f2-ff18-58e9-bc7b-31028e88f75d"
27
+ EnzymeCore = " f151be2c-9106-41f4-ab19-57ee4f262869"
27
28
28
29
[extensions ]
29
30
DynamicPPLMCMCChainsExt = [" MCMCChains" ]
31
+ DynamicPPLEnzymeCoreExt = [" EnzymeCore" ]
30
32
31
33
[compat ]
32
34
AbstractMCMC = " 5"
@@ -38,6 +40,7 @@ Compat = "4"
38
40
ConstructionBase = " 1.5.4"
39
41
Distributions = " 0.25"
40
42
DocStringExtensions = " 0.9"
43
+ EnzymeCore = " 0.6"
41
44
LogDensityProblems = " 2"
42
45
MCMCChains = " 6"
43
46
MacroTools = " 0.5.6"
@@ -52,3 +55,4 @@ julia = "1.6"
52
55
53
56
[extras ]
54
57
MCMCChains = " c7f686f2-ff18-58e9-bc7b-31028e88f75d"
58
+ EnzymeCore = " f151be2c-9106-41f4-ab19-57ee4f262869"
Original file line number Diff line number Diff line change
1
+ module DynamicPPLEnzymeCoreExt
2
+
3
+ if isdefined (Base, :get_extension )
4
+ using DynamicPPL: DynamicPPL
5
+ using EnzymeCore
6
+ else
7
+ using .. DynamicPPL: DynamicPPL
8
+ using .. EnzymeCore
9
+ end
10
+
11
+ @inline EnzymeCore. EnzymeRules. inactive_type (:: Type{<:DynamicPPL.SamplingContext} ) = true
12
+
13
+ end
Original file line number Diff line number Diff line change 189
189
@require MCMCChains = " c7f686f2-ff18-58e9-bc7b-31028e88f75d" include (
190
190
" ../ext/DynamicPPLMCMCChainsExt.jl"
191
191
)
192
+ @require EnzymeCore = " f151be2c-9106-41f4-ab19-57ee4f262869" include (
193
+ " ../ext/DynamicPPLEnzymeCoreExt.jl"
194
+ )
192
195
end
193
196
end
194
197
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
7
7
Distributions = " 31c24e10-a181-5473-b8eb-7969acd0382f"
8
8
DistributionsAD = " ced4e74d-a319-5a8a-b0ac-84af2272839c"
9
9
Documenter = " e30172f5-a6a5-5a46-863b-614d45cd2de4"
10
+ EnzymeCore = " f151be2c-9106-41f4-ab19-57ee4f262869"
10
11
ForwardDiff = " f6369f11-7733-5829-9624-2563aa707210"
11
12
LinearAlgebra = " 37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
12
13
LogDensityProblems = " 6fdf6af0-433a-55f7-b3ed-c6c6e0b8df7c"
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ using DynamicPPL:
16
16
hasconditioned_nested,
17
17
getconditioned_nested
18
18
19
+ using EnzymeCore
20
+
19
21
# Dummy context to test nested behaviors.
20
22
struct ParentContext{C<: AbstractContext } <: AbstractContext
21
23
context:: C
252
254
@test SamplingContext (Random. default_rng (), DefaultContext ()) == context
253
255
@test SamplingContext (SampleFromPrior (), DefaultContext ()) == context
254
256
@test SamplingContext (SampleFromPrior (), DefaultContext ()) == context
257
+ @test EnzymeCore. EnzymeRules. inactive_type (typeof (context))
255
258
end
256
259
257
260
@testset " FixedContext" begin
You can’t perform that action at this time.
0 commit comments