Default float type to float(Real), not Real #685
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #684
The issue seen in #684 results from this series of calls:
DynamicPPL.jl/src/model.jl
Lines 1190 to 1200 in cdd3407
Here,
argvals_dict
is anOrderedDict
, and whenlikelihood()
is called on L1198 it gets promoted to aSimpleVarInfo
where the type oflogp
isfloat_type_with_fallback(infer_nested_eltype(typeof(argvals_dict)))
:DynamicPPL.jl/src/simple_varinfo.jl
Lines 214 to 222 in cdd3407
In this case,
infer_nested_eltype(typeof(argvals_dict))
isAny
and thusfloat_type_with_fallback(Any)
givesReal
. And then whenresetlogp!!
is called, it sets logp tozero(Real)
, which ends up being anInt64
(on my system).This PR proposes to make
float_type_with_fallback(Any)
returnfloat(Real)
instead, which isFloat64
.