-
Notifications
You must be signed in to change notification settings - Fork 246
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 numpyro.collapse #773
Add numpyro.collapse #773
Conversation
…d due to Meta class
|
||
if msg["type"] == "sample": | ||
if msg["value"] is None: | ||
msg["value"] = msg["name"] |
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.
Is there no need for msg["done"] = True
as in Pyro?
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.
We don't have msg["done"]
in NumPyro. What does it do?
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.
@eb8680 can you explain msg["done"]
vs msg["stop"]
?
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.
msg["done"]
indicates that msg["value"]
is final and should not be changed by subsequent handlers. In this case it would equivalent to msg["value"] is not None
, although it can occasionally be useful to distinguish between these situations.
def model(): | ||
c = numpyro.sample("c", dist.Gamma(1, 1)) | ||
with handlers.collapse(): | ||
probs = numpyro.sample("probs", dist.Beta(c, 2)) | ||
with numpyro.plate("plate", len(data)): | ||
numpyro.sample("obs", dist.Binomial(10, probs), | ||
obs=data) |
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.
cc @neerajprad I believe this is basically the mobb model 😄
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.
LGTM
Resolves #756.
TODO:
Blocked by pyro-ppl/funsor#377