DynamicPPL.jl
DynamicPPL.jl copied to clipboard
Storing returned values in `VarInfo`.
We have debated for length about how to handle returned values from a DynamicPPL model, and use that as a way to store extra non-parameter model variables (e.g. transformed variables and generated quantities; see here). One straightforward approach is to introduce an extra field in SimpleVarInfo
, e.g.
struct SimpleVarInfo
logp
values
ret_values
transformation
end
We can safely compress the ret_values
and values
into one field and skip ret_values
during inference.
More generally, the returned value can be a closure, allowing us to easily perform post-inference tasks, e.g., prediction.