You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Distributions there is a long-standing discussion about how to specify the type of samples from a Distribution. This is important for code involving GPU computations that often needs Float32 rather than Float64.
Currently, this eltype of the sample is somehow mingled with the type of the parameters in Distributions.jl.
One suggestion is, to specify the eltype with a new variant of the rand function: rand(::Type{T}, ::Sampleable, ...)
In the linked issue, I argued for an alternative solution where this type can be specified with the Distribution, because the rand approach is not straightforward to extend to Turing. In Turing, the user, i.e. the author of the model, does not call the rand function directly, but relies on specifying the distribution, that a prior is sampled from.
However, it is believed that Turing should adapt.
Indeed, it seems that it can already be specified with the default type parameter in the Turing.@model macro, like Turing.@model function tmodel_cross(obs_target, ::Type{T} = Float32) where {T}
Contrary, if it would be hard for Turing to adapt its syntax to specify the eltype of the Sampleable, this would be good time to contribute the discussion at the linked Distribution.jl issue.
The text was updated successfully, but these errors were encountered:
In Distributions there is a long-standing discussion about how to specify the type of samples from a Distribution. This is important for code involving GPU computations that often needs
Float32
rather thanFloat64
.Currently, this eltype of the sample is somehow mingled with the type of the parameters in
Distributions.jl
.One suggestion is, to specify the eltype with a new variant of the rand function:
rand(::Type{T}, ::Sampleable, ...)
In the linked issue, I argued for an alternative solution where this type can be specified with the Distribution, because the rand approach is not straightforward to extend to Turing. In Turing, the user, i.e. the author of the model, does not call the
rand
function directly, but relies on specifying the distribution, that a prior is sampled from.However, it is believed that Turing should adapt.
Indeed, it seems that it can already be specified with the default type parameter in the
Turing.@model
macro, likeTuring.@model function tmodel_cross(obs_target, ::Type{T} = Float32) where {T}
Contrary, if it would be hard for Turing to adapt its syntax to specify the eltype of the Sampleable, this would be good time to contribute the discussion at the linked Distribution.jl issue.
The text was updated successfully, but these errors were encountered: