Skip to content

Commit 63bd6b0

Browse files
authored
Remove DEBUG constant (#389)
1 parent b42abf3 commit 63bd6b0

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

src/AdvancedHMC.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module AdvancedHMC
22

3-
const DEBUG = convert(Bool, parse(Int, get(ENV, "DEBUG_AHMC", "0")))
4-
53
using Statistics: mean, var, middle
64
using LinearAlgebra:
75
Symmetric, UpperTriangular, mul!, ldiv!, dot, I, diag, cholesky, UniformScaling

src/adaptation/Adaptation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using LinearAlgebra: LinearAlgebra
55
using Statistics: Statistics
66
using SimpleUnPack: @unpack, @pack!
77

8-
using ..AdvancedHMC: DEBUG, AbstractScalarOrVec
8+
using ..AdvancedHMC: AbstractScalarOrVec
99
using DocStringExtensions
1010

1111
"""

src/adaptation/stepsize.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function adapt_stepsize!(
102102
da::NesterovDualAveraging{T},
103103
α::AbstractScalarOrVec{<:T},
104104
) where {T<:AbstractFloat}
105-
DEBUG && @debug "Adapting step size..." α
105+
@debug "Adapting step size..." α
106106

107107
# Clip average MH acceptance probability
108108
if α isa AbstractVector
@@ -124,7 +124,7 @@ function adapt_stepsize!(
124124
x_bar = (one(T) - η_x) * x_bar .+ η_x * x
125125

126126
ϵ = exp.(x)
127-
DEBUG && @debug "Adapting step size..." "new ϵ = " "old ϵ = $(da.state.ϵ)"
127+
@debug "Adapting step size..." new_ϵ = ϵ old_ϵ = da.state.ϵ
128128

129129
# TODO: we might want to remove this when all other numerical issues are correctly handelled
130130
if any(isnan.(ϵ)) || any(isinf.(ϵ))

src/trajectory.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ function find_good_stepsize(
791791
ϵ′ = direction == 1 ? d * ϵ : 1 / d * ϵ
792792
z′, H′ = A(h, z, ϵ)
793793
ΔH = H - H′
794-
DEBUG && @debug "Crossing step" direction H′ ϵ "α = $(min(1, exp(ΔH)))"
794+
@debug "Crossing step" direction H′ ϵ α = min(1, exp(ΔH))
795795
if (direction == 1) && !(ΔH > log(a_cross))
796796
break
797797
elseif (direction == -1) && !(ΔH < log(a_cross))
@@ -815,7 +815,7 @@ function find_good_stepsize(
815815
ϵ_mid = middle(ϵ, ϵ′)
816816
z′, H′ = A(h, z, ϵ_mid)
817817
ΔH = H - H′
818-
DEBUG && @debug "Bisection step" H′ ϵ_mid "α = $(min(1, exp(ΔH)))"
818+
@debug "Bisection step" H′ ϵ_mid α = min(1, exp(ΔH))
819819
if (exp(ΔH) > a_max)
820820
ϵ = ϵ_mid
821821
elseif (exp(ΔH) < a_min)

0 commit comments

Comments
 (0)