Skip to content

Commit 083dfa1

Browse files
PavanChaggaryebaidevmotion
authored
removing AbstractContext def and importing from AbstractPPL (#382)
* removing AbstractContext def and importing from AbstractPPL * Update Project.toml * Update Project.toml * Update to AbstractPPL 0.5 (PR to #382) (#385) This PR updates #382. It - removes the `import` statement and instead qualifies all extended functions explicitly - updates test/Project.toml * Update bors.toml Co-authored-by: Hong Ge <[email protected]> Co-authored-by: David Widmann <[email protected]>
1 parent 7f4f990 commit 083dfa1

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DynamicPPL"
22
uuid = "366bfd00-2699-11ea-058f-f148b4cae6d8"
3-
version = "0.17.6"
3+
version = "0.17.7"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
@@ -18,7 +18,7 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
1818

1919
[compat]
2020
AbstractMCMC = "2, 3.0"
21-
AbstractPPL = "0.3, 0.4"
21+
AbstractPPL = "0.5.1"
2222
BangBang = "0.3"
2323
Bijectors = "0.5.2, 0.6, 0.7, 0.8, 0.9, 0.10"
2424
ChainRulesCore = "0.9.7, 0.10, 1"

bors.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ delete_merged_branches = true
1515
required_approvals = 1
1616
# Squash commits before merging.
1717
use_squash_merge = true
18-
# Uncomment this to use a three hour timeout.
18+
# Uncomment this to use a four hour timeout.
1919
# The default is one hour.
20-
timeout_sec = 10800
20+
timeout_sec = 14400

src/DynamicPPL.jl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@ module DynamicPPL
22

33
using AbstractMCMC: AbstractSampler, AbstractChains
44
using AbstractPPL
5-
using Distributions
65
using Bijectors
6+
using Distributions
77

88
using AbstractMCMC: AbstractMCMC
9+
using BangBang: BangBang, push!!, empty!!, setindex!!
910
using ChainRulesCore: ChainRulesCore
1011
using MacroTools: MacroTools
11-
using ZygoteRules: ZygoteRules
12-
using BangBang: BangBang
1312
using Setfield: Setfield
14-
15-
using Setfield: Setfield
16-
using BangBang: BangBang
13+
using ZygoteRules: ZygoteRules
1714

1815
using Random: Random
1916

@@ -32,8 +29,6 @@ import Base:
3229
keys,
3330
haskey
3431

35-
using BangBang: push!!, empty!!, setindex!!
36-
3732
# VarInfo
3833
export AbstractVarInfo,
3934
VarInfo,
@@ -137,7 +132,6 @@ log joint probability of the model.
137132
See also: [`VarInfo`](@ref)
138133
"""
139134
abstract type AbstractVarInfo <: AbstractModelTrace end
140-
abstract type AbstractContext end
141135

142136
include("utils.jl")
143137
include("selector.jl")

src/model.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,17 @@ Returns both the return-value of the original model, and the resulting varinfo.
397397
The method resets the log joint probability of `varinfo` and increases the evaluation
398398
number of `sampler`.
399399
"""
400-
function evaluate!!(model::Model, varinfo::AbstractVarInfo, context::AbstractContext)
400+
function AbstractPPL.evaluate!!(
401+
model::Model, varinfo::AbstractVarInfo, context::AbstractContext
402+
)
401403
return if use_threadsafe_eval(context, varinfo)
402404
evaluate_threadsafe!!(model, varinfo, context)
403405
else
404406
evaluate_threadunsafe!!(model, varinfo, context)
405407
end
406408
end
407409

408-
function evaluate!!(
410+
function AbstractPPL.evaluate!!(
409411
model::Model,
410412
rng::Random.AbstractRNG,
411413
varinfo::AbstractVarInfo=VarInfo(),
@@ -415,21 +417,25 @@ function evaluate!!(
415417
return evaluate!!(model, varinfo, SamplingContext(rng, sampler, context))
416418
end
417419

418-
evaluate!!(model::Model, context::AbstractContext) = evaluate!!(model, VarInfo(), context)
420+
function AbstractPPL.evaluate!!(model::Model, context::AbstractContext)
421+
return evaluate!!(model, VarInfo(), context)
422+
end
419423

420-
function evaluate!!(model::Model, args...)
424+
function AbstractPPL.evaluate!!(model::Model, args...)
421425
return evaluate!!(model, Random.GLOBAL_RNG, args...)
422426
end
423427

424428
# without VarInfo
425-
function evaluate!!(
429+
function AbstractPPL.evaluate!!(
426430
model::Model, rng::Random.AbstractRNG, sampler::AbstractSampler, args...
427431
)
428432
return evaluate!!(model, rng, VarInfo(), sampler, args...)
429433
end
430434

431435
# without VarInfo and without AbstractSampler
432-
function evaluate!!(model::Model, rng::Random.AbstractRNG, context::AbstractContext)
436+
function AbstractPPL.evaluate!!(
437+
model::Model, rng::Random.AbstractRNG, context::AbstractContext
438+
)
433439
return evaluate!!(model, rng, VarInfo(), SampleFromPrior(), context)
434440
end
435441

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
2121

2222
[compat]
2323
AbstractMCMC = "2.1, 3.0"
24-
AbstractPPL = "0.3, 0.4"
24+
AbstractPPL = "0.5.1"
2525
Bijectors = "0.9.5, 0.10"
2626
Distributions = "0.25"
2727
DistributionsAD = "0.6.3"

0 commit comments

Comments
 (0)