@@ -8,13 +8,22 @@ using Random: Random
8
8
using StableRNGs: StableRNG
9
9
using Test
10
10
using .. Models: gdemo_default
11
- import ForwardDiff, ReverseDiff, Mooncake
11
+ import ForwardDiff, ReverseDiff
12
+
13
+ # Detect if prerelease version, if so, we skip some tests
14
+ const IS_PRERELEASE = ! isempty (VERSION . prerelease)
15
+ const INCLUDE_MOONCAKE = ! IS_PRERELEASE
16
+
17
+ if INCLUDE_MOONCAKE
18
+ Pkg. add (" Mooncake" )
19
+ using Mooncake: Mooncake
20
+ end
12
21
13
22
""" Element types that are always valid for a VarInfo regardless of ADType."""
14
23
const always_valid_eltypes = (AbstractFloat, AbstractIrrational, Integer, Rational)
15
24
16
25
""" A dictionary mapping ADTypes to the element types they use."""
17
- const eltypes_by_adtype = Dict (
26
+ eltypes_by_adtype = Dict (
18
27
Turing. AutoForwardDiff => (ForwardDiff. Dual,),
19
28
Turing. AutoReverseDiff => (
20
29
ReverseDiff. TrackedArray,
@@ -25,8 +34,10 @@ const eltypes_by_adtype = Dict(
25
34
ReverseDiff. TrackedVecOrMat,
26
35
ReverseDiff. TrackedVector,
27
36
),
28
- Turing. AutoMooncake => (Mooncake. CoDual,),
29
37
)
38
+ if INCLUDE_MOONCAKE
39
+ eltypes_by_adtype[Turing. AutoMooncake] = (Mooncake. CoDual,)
40
+ end
30
41
31
42
"""
32
43
AbstractWrongADBackendError
@@ -177,11 +188,10 @@ end
177
188
"""
178
189
All the ADTypes on which we want to run the tests.
179
190
"""
180
- ADTYPES = [
181
- Turing. AutoForwardDiff (),
182
- Turing. AutoReverseDiff (; compile= false ),
183
- Turing. AutoMooncake (; config= nothing ),
184
- ]
191
+ ADTYPES = [Turing. AutoForwardDiff (), Turing. AutoReverseDiff (; compile= false )]
192
+ if INCLUDE_MOONCAKE
193
+ push! (ADTYPES, Turing. AutoMooncake (; config= nothing ))
194
+ end
185
195
186
196
# Check that ADTypeCheckContext itself works as expected.
187
197
@testset " ADTypeCheckContext" begin
0 commit comments