Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AdvancedPS"
uuid = "576499cb-2369-40b2-a588-c64705576edc"
authors = ["TuringLang"]
version = "0.3"
version = "0.3.1"

[deps]
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
Expand All @@ -13,6 +13,6 @@ StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
[compat]
AbstractMCMC = "2, 3"
Distributions = "0.23, 0.24, 0.25"
Libtask = "0.6"
Libtask = "0.6.2"
StatsFuns = "0.9"
julia = "1.3"
14 changes: 12 additions & 2 deletions src/container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ end
const Particle = Trace

function Trace(f)
ctask = Libtask.CTask(f)
if hasfield(typeof(f), :evaluator) # Test whether f is a Turing.TracedModel
# println(f.evaluator)
ctask = Libtask.CTask(f.evaluator[1], f.evaluator[2:end]...)
else # f is a Function, or AdavncedPS.Model
ctask = Libtask.CTask(f)
end

# add backward reference
newtrace = Trace(f, ctask)
Expand Down Expand Up @@ -42,7 +47,12 @@ end
# Create new task and copy randomness
function forkr(trace::Trace)
newf = reset_model(trace.f)
ctask = Libtask.CTask(trace.ctask)
# ctask = Libtask.CTask(trace.ctask)
if hasfield(typeof(newf), :evaluator) # Test whether f is a Turing.TracedModel
ctask = Libtask.CTask(newf.evaluator[1], newf.evaluator[2:end]...)
else # f is a Function, or AdavncedPS.Model
ctask = Libtask.CTask(newf)
end

# add backward reference
newtrace = Trace(newf, ctask)
Expand Down