Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Turing"
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
version = "0.15.2"
version = "0.15.3"

[deps]
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
Expand Down Expand Up @@ -43,7 +43,7 @@ Bijectors = "0.8"
Distributions = "0.23.3, 0.24"
DistributionsAD = "0.6"
DocStringExtensions = "0.8"
DynamicPPL = "0.10.0"
DynamicPPL = "0.10.2"
EllipticalSliceSampling = "0.3"
ForwardDiff = "0.10.3"
Libtask = "0.4, 0.5"
Expand Down
30 changes: 0 additions & 30 deletions src/inference/Inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -429,36 +429,6 @@ for alg in (:HMC, :HMCDA, :NUTS, :SGLD, :SGHMC)
@eval DynamicPPL.getspace(::$alg{<:Any, space}) where {space} = space
end

floatof(::Type{T}) where {T <: Real} = typeof(one(T)/one(T))
floatof(::Type) = Real # fallback if type inference failed

function get_matching_type(
spl::AbstractSampler,
vi,
::Type{T},
) where {T}
return T
end
function get_matching_type(
spl::AbstractSampler,
vi,
::Type{<:Union{Missing, AbstractFloat}},
)
return Union{Missing, floatof(eltype(vi, spl))}
end
function get_matching_type(
spl::AbstractSampler,
vi,
::Type{<:AbstractFloat},
)
return floatof(eltype(vi, spl))
end
function get_matching_type(spl::AbstractSampler, vi, ::Type{<:Array{T,N}}) where {T,N}
return Array{get_matching_type(spl, vi, T), N}
end
function get_matching_type(spl::AbstractSampler, vi, ::Type{<:Array{T}}) where T
return Array{get_matching_type(spl, vi, T)}
end
function get_matching_type(
spl::Sampler{<:Union{PG, SMC}},
vi,
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CmdStan = "6.0.8"
Distributions = "0.23.8, 0.24"
DistributionsAD = "0.6.3"
DynamicHMC = "2.1.6"
DynamicPPL = "0.10.0"
DynamicPPL = "0.10.2"
FiniteDifferences = "0.10.8, 0.11"
ForwardDiff = "0.10.12"
MCMCChains = "4.0.4"
Expand Down