Skip to content

Commit

Permalink
TracedModel - CTask (#1770)
Browse files Browse the repository at this point in the history
* Add taped-ctask

* Add prefix for libtask APIs.

Co-authored-by: Hong Ge <[email protected]>
  • Loading branch information
FredericWantiez and yebai authored Feb 3, 2022
1 parent fca2fb0 commit 715dd98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/essential/container.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,11 @@ function AdvancedPS.reset_logprob!(f::TracedModel)
DynamicPPL.resetlogp!!(f.varinfo)
return
end

function Libtask.CTask(model::TracedModel)
return Libtask.CTask(model.evaluator[1], model.evaluator[2:end]...)
end

function Libtask.CTask(model::TracedModel, ::Random.AbstractRNG)
return Libtask.CTask(model)
end
2 changes: 1 addition & 1 deletion src/inference/AdvancedSMC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ function DynamicPPL.assume(
end

function DynamicPPL.observe(spl::Sampler{<:Union{PG,SMC}}, dist::Distribution, value, vi)
produce(logpdf(dist, value))
Libtask.produce(logpdf(dist, value))
return 0, vi
end

Expand Down

2 comments on commit 715dd98

@yebai
Copy link
Member

@yebai yebai commented on 715dd98 Feb 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/53828

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.20.0 -m "<description of version>" 715dd985ac331f5df26338e6b30ac686015610c4
git push origin v0.20.0

Please sign in to comment.