Skip to content

Commit 14dbb9f

Browse files
committed
Added debug statements to link! and invlink! (#206)
As mentioned here: https://github.com/TuringLang/Turing.jl/pull/1497/files#r547599474 Figured it would be best to make a PR and discuss whether this change is desirable here. Are there any perf-considerations to this? We already have if-statements in there, e.g. `istrans`, so another one due to the `@debug` shouldn't make much of a difference.
1 parent 5b5c205 commit 14dbb9f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
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.10.2"
3+
version = "0.10.3"
44

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

src/varinfo.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ function link!(vi::UntypedVarInfo, spl::Sampler)
700700
vns = _getvns(vi, spl)
701701
if ~istrans(vi, vns[1])
702702
for vn in vns
703+
@debug "X -> ℝ for $(vn)..."
703704
dist = getdist(vi, vn)
704705
# TODO: Use inplace versions to avoid allocations
705706
setval!(vi, vectorize(dist, Bijectors.link(dist, reconstruct(dist, getval(vi, vn)))), vn)
@@ -722,6 +723,7 @@ end
722723
if ~istrans(vi, f_vns[1])
723724
# Iterate over all `f_vns` and transform
724725
for vn in f_vns
726+
@debug "X -> R for $(vn)..."
725727
dist = getdist(vi, vn)
726728
setval!(vi, vectorize(dist, Bijectors.link(dist, reconstruct(dist, getval(vi, vn)))), vn)
727729
settrans!(vi, true, vn)
@@ -747,6 +749,7 @@ function invlink!(vi::UntypedVarInfo, spl::AbstractSampler)
747749
vns = _getvns(vi, spl)
748750
if istrans(vi, vns[1])
749751
for vn in vns
752+
@debug "ℝ -> X for $(vn)..."
750753
dist = getdist(vi, vn)
751754
setval!(vi, vectorize(dist, Bijectors.invlink(dist, reconstruct(dist, getval(vi, vn)))), vn)
752755
settrans!(vi, false, vn)
@@ -768,6 +771,7 @@ end
768771
if istrans(vi, f_vns[1])
769772
# Iterate over all `f_vns` and transform
770773
for vn in f_vns
774+
@debug "ℝ -> X for $(vn)..."
771775
dist = getdist(vi, vn)
772776
setval!(vi, vectorize(dist, Bijectors.invlink(dist, reconstruct(dist, getval(vi, vn)))), vn)
773777
settrans!(vi, false, vn)

0 commit comments

Comments
 (0)