Skip to content

Commit c2c4d8b

Browse files
authored
Use Random.default_rng (#43)
1 parent 64ef0ee commit c2c4d8b

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "AdvancedVI"
22
uuid = "b5ca4192-6429-45e5-a2d9-87aec30a685c"
3-
version = "0.2.0"
3+
version = "0.2.1"
44

55
[deps]
66
Bijectors = "76274a88-744f-5084-9051-94815aaf08c4"

src/AdvancedVI.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module AdvancedVI
22

3-
using Random: AbstractRNG
3+
using Random: Random
44

55
using Distributions, DistributionsAD, Bijectors
66
using DocStringExtensions

src/advi.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ using StatsFuns
22
using DistributionsAD
33
using Bijectors
44
using Bijectors: TransformedDistribution
5-
using Random: AbstractRNG, GLOBAL_RNG
65

76

87
"""
@@ -53,7 +52,7 @@ end
5352

5453
# WITHOUT updating parameters inside ELBO
5554
function (elbo::ELBO)(
56-
rng::AbstractRNG,
55+
rng::Random.AbstractRNG,
5756
alg::ADVI,
5857
q::VariationalPosterior,
5958
logπ::Function,

src/objectives.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
using Random: GLOBAL_RNG
2-
31
struct ELBO <: VariationalObjective end
42

53
function (elbo::ELBO)(alg, q, logπ, num_samples; kwargs...)
6-
return elbo(GLOBAL_RNG, alg, q, logπ, num_samples; kwargs...)
4+
return elbo(Random.default_rng(), alg, q, logπ, num_samples; kwargs...)
75
end
86

97
const elbo = ELBO()

src/utils.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Distributions
22

3-
using Random: Random
43
using Bijectors: Bijectors
54

65

0 commit comments

Comments
 (0)