Skip to content

Commit 4e0bd08

Browse files
authored
Remove some @debug statements (#1499)
1 parent fe9bee2 commit 4e0bd08

File tree

5 files changed

+9
-24
lines changed

5 files changed

+9
-24
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Turing"
22
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
3-
version = "0.15.6"
3+
version = "0.15.7"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

src/contrib/inference/sghmc.jl

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,29 +82,26 @@ function step(
8282
η, α = spl.alg.learning_rate, spl.alg.momentum_decay
8383
spl.info[:eval_num] = 0
8484

85-
@debug "X-> R..."
8685
if spl.selector.tag != :default
8786
link!(vi, spl)
8887
model(vi, spl)
8988
end
9089

91-
@debug "recording old variables..."
90+
# Record old variables
9291
θ, v = vi[spl], spl.info[:v]
9392
_, grad = gradient_logp(θ, vi, model, spl)
9493
verifygrad(grad)
9594

96-
# Implements the update equations from (15) of Chen et al. (2014).
97-
@debug "update latent variables and velocity..."
95+
# Update latent variables and velocity according to (15) of Chen et al. (2014)
9896
θ .+= v
9997
v .= (1 - α) .* v .+ η .* grad .+ rand.(Normal.(zeros(length(θ)), sqrt(2 * η * α)))
10098

101-
@debug "saving new latent variables..."
99+
# Save new latent variables
102100
vi[spl] = θ
103101

104-
@debug "R -> X..."
105102
spl.selector.tag != :default && invlink!(vi, spl)
106103

107-
@debug "always accept..."
104+
# Always accept
108105
return vi, true
109106
end
110107

@@ -189,30 +186,28 @@ function step(
189186
spl.info[:i] += 1
190187
spl.info[:eval_num] = 0
191188

192-
@debug "compute current step size..."
189+
# Compute current step size
193190
γ = .35
194191
ϵ_t = spl.alg.ϵ / spl.info[:i]^γ # NOTE: Choose γ=.55 in paper
195192
mssa = spl.info[:adaptor].ssa
196193
mssa.state.ϵ = ϵ_t
197194

198-
@debug "X-> R..."
199195
if spl.selector.tag != :default
200196
link!(vi, spl)
201197
model(vi, spl)
202198
end
203199

204-
@debug "recording old variables..."
200+
# Record old variables
205201
θ = vi[spl]
206202
_, grad = gradient_logp(θ, vi, model, spl)
207203
verifygrad(grad)
208204

209-
@debug "update latent variables..."
205+
# Update latent variables
210206
θ .+= ϵ_t .* grad ./ 2 .- rand.(Normal.(zeros(length(θ)), sqrt(ϵ_t)))
211207

212-
@debug "always accept..."
208+
# Always accept
213209
vi[spl] = θ
214210

215-
@debug "R -> X..."
216211
spl.selector.tag != :default && invlink!(vi, spl)
217212

218213
return vi, true

src/inference/gibbs.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,10 @@ function AbstractMCMC.step(
153153
state::GibbsState;
154154
kwargs...
155155
)
156-
@debug "Gibbs stepping..."
157-
158156
# Iterate through each of the samplers.
159157
vi = state.vi
160158
samplers = state.samplers
161159
states = map(samplers, state.states) do _sampler, _state
162-
@debug "$(typeof(_sampler)) stepping..."
163-
164160
# Update state of current sampler with updated `VarInfo` object.
165161
current_state = gibbs_update_state(_state, vi)
166162

src/inference/hmc.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ function DynamicPPL.initialstep(
213213
end
214214

215215
# Update `vi` based on acceptance
216-
@debug "decide whether to accept..."
217216
if t.stat.is_accept
218217
vi[spl] = t.z.θ
219218
setlogp!(vi, t.stat.log_density)
@@ -227,7 +226,6 @@ function DynamicPPL.initialstep(
227226

228227
# If a Gibbs component, transform the values back to the constrained space.
229228
if spl.selector.tag !== :default
230-
@debug "R -> X..."
231229
invlink!(vi, spl)
232230
end
233231

@@ -252,7 +250,6 @@ function AbstractMCMC.step(
252250

253251
# When a Gibbs component, transform values to the unconstrained space.
254252
if spl.selector.tag !== :default
255-
@debug "X-> R..."
256253
link!(vi, spl)
257254
model(rng, vi, spl)
258255
end
@@ -287,7 +284,6 @@ function AbstractMCMC.step(
287284
end
288285

289286
# Update `vi` based on acceptance
290-
@debug "decide whether to accept..."
291287
if t.stat.is_accept
292288
vi[spl] = t.z.θ
293289
setlogp!(vi, t.stat.log_density)
@@ -302,7 +298,6 @@ function AbstractMCMC.step(
302298

303299
# If a Gibbs component, transform the values back to the constrained space.
304300
if spl.selector.tag !== :default
305-
@debug "R -> X..."
306301
invlink!(vi, spl)
307302
end
308303

src/variational/advi.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ function AdvancedVI.vi(
117117
q::Bijectors.TransformedDistribution{<:DistributionsAD.TuringDiagMvNormal};
118118
optimizer = AdvancedVI.TruncatedADAGrad(),
119119
)
120-
@debug "Optimizing ADVI..."
121120
# Initial parameters for mean-field approx
122121
μ, σs = StatsBase.params(q)
123122
θ = vcat(μ, StatsFuns.invsoftplus.(σs))

0 commit comments

Comments
 (0)