Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampling from Dirichlet Dist breaks with Float32 #956

Closed
dinarior opened this issue Aug 22, 2019 · 0 comments
Closed

Sampling from Dirichlet Dist breaks with Float32 #956

dinarior opened this issue Aug 22, 2019 · 0 comments

Comments

@dinarior
Copy link
Contributor

dinarior commented Aug 22, 2019

rand(Dirichlet([Float32(10),Float32(10)]))

Results in the following error:

ERROR: MethodError: no method matching Distributions.GammaGDSampler(::Float32, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float32, ::Float32, ::Float32, ::Float32)
Closest candidates are:
  Distributions.GammaGDSampler(::T<:Real, ::T<:Real, ::T<:Real, ::T<:Real, ::T<:Real, ::T<:Real, ::T<:Real, ::T<:Real, ::T<:Real, ::T<:Real) where T<:Real at /home/dinari/.julia/packages/Distributions/tfkz4/src/samplers/gamma.jl:10
Stacktrace:
 [1] Distributions.GammaGDSampler(::Gamma{Float32}) at /home/dinari/.julia/packages/Distributions/tfkz4/src/samplers/gamma.jl:57
 [2] rand(::Random.MersenneTwister, ::Gamma{Float32}) at /home/dinari/.julia/packages/Distributions/tfkz4/src/univariate/continuous/gamma.jl:98
 [3] _rand!(::Random.MersenneTwister, ::Dirichlet{Float32}, ::Array{Float32,1}) at /home/dinari/.julia/packages/Distributions/tfkz4/src/multivariate/dirichlet.jl:190
 [4] rand(::Dirichlet{Float32}) at /home/dinari/.julia/packages/Distributions/tfkz4/src/multivariates.jl:83
 [5] top-level scope at REPL[17]:1

Probably related to this

matbesancon added a commit that referenced this issue Aug 22, 2019
* Relax Gamma Sampler types (#956)

*relax T into Real in gamma sampler

* Fixed to keep the T type dispatch, also added a test in dirichlet.

* Update src/samplers/gamma.jl

Co-Authored-By: Mathieu Besançon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant