[go: up one dir, main page]

Skip to content

return statement in the model definition #1720

Answered by torfjelde
jeremiecoullon asked this question in Q&A
Discussion options

You must be logged in to vote

So the return-statement in Turing.jl just like a standard return-statement in a function. This means that if you do m = gdemo(...); m() you will get the return values, whatever they might be. The return-statement has nothing to do with the sampling/inference (unless it we hit a "early" return ), hence if you just want to sample from the posterior you don't need it.

One useful case you might want to check out is the docstring of Turing.generated_quantities. There you'll find an example of how we can exploit the return-statement to do something useful even if you're only interested in posterior inference:)

EDIT: generated_quantites is "kind of" new and so we haven't documented it properly y…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jeremiecoullon
Comment options

Answer selected by jeremiecoullon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants