autoppl
v0.8
A C++ template library for probabilistic programming
|
Go to the documentation of this file.
11 template <
class ModelExpr>
37 template <
class TupExprType
41 template <
class ModelExpr>
43 std::enable_if_t<util::is_model_expr_v<ModelExpr>
46 ProgramNode<std::tuple<ModelExpr>,
47 std::enable_if_t<util::is_model_expr_v<ModelExpr>> >
59 auto log_pdf() {
return model_.log_pdf(); }
61 template <
class PtrPackType>
63 return model_.ad_log_pdf(pack);
68 model_.activate_refcnt();
72 template <
class PtrPackType>
73 void bind(
const PtrPackType& pack) {
77 template <
class GenType>
85 template <
class TPExpr,
class ModelExpr>
88 util::is_var_expr_v<TPExpr> &&
89 util::is_model_expr_v<ModelExpr>
92 ProgramNode<std::tuple<TPExpr, ModelExpr>,
94 util::is_var_expr_v<TPExpr> &&
95 util::is_model_expr_v<ModelExpr>> >
102 using base_t::model_;
112 return model_.log_pdf();
115 template <
class PtrPackType>
117 return (tp_expr_.ad(pack), model_.ad_log_pdf(pack));
123 tp_expr_.activate_refcnt();
124 model_.activate_refcnt();
128 cont_res = std::get<0>(model_res);
129 cont_res.
tp_offset = std::get<0>(tp_res).tp_offset;
130 disc_res = std::get<1>(model_res);
131 disc_res.
tp_offset = std::get<1>(tp_res).tp_offset;
132 return std::make_pair(cont_res, disc_res);
135 template <
class PtrPackType>
136 void bind(
const PtrPackType& pack) {
141 template <
class GenType>
144 double radius = 2.) {
void bind(const PtrPackType &pack)
Definition: program.hpp:136
model_t model_
Definition: program.hpp:23
auto log_pdf()
Definition: program.hpp:59
Definition: program_expr_traits.hpp:9
auto activate() const
Definition: program.hpp:66
auto & get_model()
Definition: program.hpp:19
Definition: program.hpp:39
Definition: program.hpp:13
void init_params(GenType &gen, bool prune=true, double radius=2.)
Definition: program.hpp:78
void bind(const PtrPackType &pack)
Definition: program.hpp:73
void init_params(ProgramType &program, GenType &gen, bool prune=true, double radius=2.)
Definition: init_params.hpp:22
ProgramNode(const model_t &model)
Definition: program.hpp:55
auto ad_log_pdf(const PtrPackType &pack) const
Definition: program.hpp:116
ModelExpr model_t
Definition: program.hpp:14
TPExpr tp_expr_t
Definition: program.hpp:100
auto ad_log_pdf(const PtrPackType &pack) const
Definition: program.hpp:62
void init_params(GenType &gen, bool prune=true, double radius=2.)
Definition: program.hpp:142
const auto & get_model() const
Definition: program.hpp:20
ProgramNodeBase(const model_t &model)
Definition: program.hpp:15
index_t tp_offset
Definition: offset_pack.hpp:14
Definition: bounded.hpp:11
Definition: offset_pack.hpp:9
auto log_pdf()
Definition: program.hpp:110
auto activate(ExprType &&expr)
Definition: activate.hpp:23
auto activate() const
Definition: program.hpp:120
ProgramNode(const tp_expr_t &tp_expr, const model_t &model)
Definition: program.hpp:104