Skip to content

Commit

Permalink
Use Random.default_rng (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion committed Feb 20, 2023
1 parent 64ef0ee commit c2c4d8b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AdvancedVI"
uuid = "b5ca4192-6429-45e5-a2d9-87aec30a685c"
version = "0.2.0"
version = "0.2.1"

[deps]
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"
Expand Down
2 changes: 1 addition & 1 deletion src/AdvancedVI.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module AdvancedVI

using Random: AbstractRNG
using Random: Random

using Distributions, DistributionsAD, Bijectors
using DocStringExtensions
Expand Down
3 changes: 1 addition & 2 deletions src/advi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ using StatsFuns
using DistributionsAD
using Bijectors
using Bijectors: TransformedDistribution
using Random: AbstractRNG, GLOBAL_RNG


"""
Expand Down Expand Up @@ -53,7 +52,7 @@ end

# WITHOUT updating parameters inside ELBO
function (elbo::ELBO)(
rng::AbstractRNG,
rng::Random.AbstractRNG,
alg::ADVI,
q::VariationalPosterior,
logπ::Function,
Expand Down
4 changes: 1 addition & 3 deletions src/objectives.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Random: GLOBAL_RNG

struct ELBO <: VariationalObjective end

function (elbo::ELBO)(alg, q, logπ, num_samples; kwargs...)
return elbo(GLOBAL_RNG, alg, q, logπ, num_samples; kwargs...)
return elbo(Random.default_rng(), alg, q, logπ, num_samples; kwargs...)
end

const elbo = ELBO()
1 change: 0 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Distributions

using Random: Random
using Bijectors: Bijectors


Expand Down

2 comments on commit c2c4d8b

@devmotion
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/78135

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" c2c4d8b3f63817e0f5d936fb134b700d76be0a59
git push origin v0.2.1

Please sign in to comment.