Skip to content

Commit a1fb1f0

Browse files
committed
Remove Turing leftovers
1 parent a6579bc commit a1fb1f0

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/DynamicPPL.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,15 @@ export VarName,
7676
LikelihoodContext,
7777
PriorContext,
7878
MiniBatchContext,
79+
# Pseudo distributions
80+
NamedDist,
81+
NoDist,
7982
# Prob macros
8083
@prob_str,
8184
@logprob_str
8285

86+
const DEBUG = Bool(parse(Int, get(ENV, "DEBUG_TURING", "0")))
87+
8388
# Used here and overloaded in Turing
8489
function getspace end
8590

src/context_implementations.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function tilde(ctx::MiniBatchContext, sampler, right, left::VarName, inds, vi)
3030
end
3131

3232
function _tilde(sampler, right, vn::VarName, vi)
33-
return Turing.assume(sampler, right, vn, vi)
33+
return assume(sampler, right, vn, vi)
3434
end
3535
function _tilde(sampler, right::NamedDist, vn::VarName, vi)
3636
name = right.name
@@ -62,14 +62,14 @@ function tilde(ctx::MiniBatchContext, sampler, right, left, vi)
6262
return ctx.loglike_scalar * tilde(ctx.ctx, sampler, right, left, vi)
6363
end
6464

65-
_tilde(sampler, right, left, vi) = Turing.observe(sampler, right, left, vi)
65+
_tilde(sampler, right, left, vi) = observe(sampler, right, left, vi)
6666

6767
function assume(spl::Sampler, dist)
68-
error("Turing.assume: unmanaged inference algorithm: $(typeof(spl))")
68+
error("DynamicPPL.assume: unmanaged inference algorithm: $(typeof(spl))")
6969
end
7070

7171
function observe(spl::Sampler, weight)
72-
error("Turing.observe: unmanaged inference algorithm: $(typeof(spl))")
72+
error("DynamicPPL.observe: unmanaged inference algorithm: $(typeof(spl))")
7373
end
7474

7575
function assume(
@@ -233,7 +233,7 @@ function dot_assume(
233233
::Any,
234234
::VarInfo
235235
)
236-
error("[Turing] $(alg_str(spl)) doesn't support vectorizing assume statement")
236+
error("[DynamicPPL] $(alg_str(spl)) doesn't support vectorizing assume statement")
237237
end
238238

239239
function get_and_set_val!(
@@ -351,8 +351,8 @@ function dot_observe(
351351
vi::VarInfo,
352352
)
353353
increment_num_produce!(vi)
354-
Turing.DEBUG && @debug "dist = $dist"
355-
Turing.DEBUG && @debug "value = $value"
354+
DynamicPPL.DEBUG && @debug "dist = $dist"
355+
DynamicPPL.DEBUG && @debug "value = $value"
356356
return sum(logpdf(dist, value))
357357
end
358358
function dot_observe(
@@ -362,8 +362,8 @@ function dot_observe(
362362
vi::VarInfo,
363363
)
364364
increment_num_produce!(vi)
365-
Turing.DEBUG && @debug "dists = $dists"
366-
Turing.DEBUG && @debug "value = $value"
365+
DynamicPPL.DEBUG && @debug "dists = $dists"
366+
DynamicPPL.DEBUG && @debug "value = $value"
367367
return sum(logpdf.(dists, value))
368368
end
369369
function dot_observe(
@@ -372,5 +372,5 @@ function dot_observe(
372372
::Any,
373373
::VarInfo,
374374
)
375-
error("[Turing] $(alg_str(spl)) doesn't support vectorizing observe statement")
375+
error("[DynamicPPL] $(alg_str(spl)) doesn't support vectorizing observe statement")
376376
end

0 commit comments

Comments
 (0)