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