@@ -21,28 +21,28 @@ it's the default AD backend used in Turing.jl.
21
21
const REFERENCE_ADTYPE = AutoForwardDiff ()
22
22
23
23
"""
24
- ADIncorrectException{T<:Real }
24
+ ADIncorrectException{T<:AbstractFloat }
25
25
26
26
Exception thrown when an AD backend returns an incorrect value or gradient.
27
27
28
28
The type parameter `T` is the numeric type of the value and gradient.
29
29
"""
30
- struct ADIncorrectException{T<: Real } <: Exception
30
+ struct ADIncorrectException{T<: AbstractFloat } <: Exception
31
31
value_expected:: T
32
32
value_actual:: T
33
33
grad_expected:: Vector{T}
34
34
grad_actual:: Vector{T}
35
35
end
36
36
37
37
"""
38
- ADResult{Tparams<:Real ,Tresult<:Real }
38
+ ADResult{Tparams<:AbstractFloat ,Tresult<:AbstractFloat }
39
39
40
40
Data structure to store the results of the AD correctness test.
41
41
42
42
The type parameter `Tparams` is the numeric type of the parameters passed in;
43
43
`Tresult` is the type of the value and the gradient.
44
44
"""
45
- struct ADResult{Tparams<: Real ,Tresult<: Real }
45
+ struct ADResult{Tparams<: AbstractFloat ,Tresult<: AbstractFloat }
46
46
" The DynamicPPL model that was tested"
47
47
model:: Model
48
48
" The VarInfo that was used"
76
76
value_atol=1e-6,
77
77
grad_atol=1e-6,
78
78
varinfo::AbstractVarInfo=link(VarInfo(model), model),
79
- params::Union{Nothing,Vector{<:Real }}=nothing,
79
+ params::Union{Nothing,Vector{<:AbstractFloat }}=nothing,
80
80
reference_adtype::ADTypes.AbstractADType=REFERENCE_ADTYPE,
81
- expected_value_and_grad::Union{Nothing,Tuple{Real ,Vector{<:Real }}}=nothing,
81
+ expected_value_and_grad::Union{Nothing,Tuple{AbstractFloat ,Vector{<:AbstractFloat }}}=nothing,
82
82
verbose=true,
83
83
)::ADResult
84
84
@@ -108,12 +108,9 @@ Everything else is optional, and can be categorised into several groups:
108
108
DynamicPPL contains several different types of VarInfo objects which change
109
109
the way model evaluation occurs. If you want to use a specific type of
110
110
VarInfo, pass it as the `varinfo` argument. Otherwise, it will default to
111
- using a `TypedVarInfo` generated from the model.
112
-
113
- It will also perform _linking_, that is, the parameters in the VarInfo will
114
- be transformed to unconstrained Euclidean space if they aren't already in
115
- that space. Note that the act of linking may change the length of the
116
- parameters. To disable linking, set `linked=false`.
111
+ using a linked `TypedVarInfo` generated from the model. Here, _linked_
112
+ means that the parameters in the VarInfo have been transformed to
113
+ unconstrained Euclidean space if they aren't already in that space.
117
114
118
115
2. _How to specify the parameters._
119
116
@@ -172,12 +169,12 @@ function run_ad(
172
169
adtype:: AbstractADType ;
173
170
test:: Bool = true ,
174
171
benchmark:: Bool = false ,
175
- value_atol:: Real = 1e-6 ,
176
- grad_atol:: Real = 1e-6 ,
172
+ value_atol:: AbstractFloat = 1e-6 ,
173
+ grad_atol:: AbstractFloat = 1e-6 ,
177
174
varinfo:: AbstractVarInfo = link (VarInfo (model), model),
178
- params:: Union{Nothing,Vector{<:Real }} = nothing ,
175
+ params:: Union{Nothing,Vector{<:AbstractFloat }} = nothing ,
179
176
reference_adtype:: AbstractADType = REFERENCE_ADTYPE,
180
- expected_value_and_grad:: Union{Nothing,Tuple{Real ,Vector{<:Real }}} = nothing ,
177
+ expected_value_and_grad:: Union{Nothing,Tuple{AbstractFloat ,Vector{<:AbstractFloat }}} = nothing ,
181
178
verbose= true ,
182
179
):: ADResult
183
180
if isnothing (params)
0 commit comments