-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add convenience forms for update and regenerate with optional args and argdiffs #236
base: master
Are you sure you want to change the base?
Conversation
src/gen_fn_interface.jl
Outdated
""" | ||
function update(trace; | ||
args::Tuple=get_args(trace), | ||
argdiffs::Tuple=map((_) -> NoChange(), args), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the default be NoChange
or UnknownChange
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now there are two convenience forms:
If you provide args, then argdiffs is an optional keyword argument that defaults to UnknownChange. (This is so you don't need to construct the unknown change argdiffs).
If you do not provide args then argdiffs is automatically set to NoChanges. (This is a common case e.g. for top-level generative functions on which we are doing MCMC or optimization).
Addresses https://github.com/probcomp/Gen/issues/229