Skip to content

Add warning when initializing a substituted model #1058

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

Merged
merged 15 commits into from
Sep 25, 2021

Conversation

fehiepsi
Copy link
Member

@fehiepsi fehiepsi commented Jun 8, 2021

Resolves #1057. For a substituted site, rng_key is not available (because seed handler knows that this site already has some value) so we can't generate a new init value. This PR adds a warning and in that case, the init strategy will return the substituted value.

I also fixed some doc formatting issues and added a note to substitute docstring regarding conditioning.

cc @llaurabat91

rng_key = site["kwargs"].get("rng_key")
sample_shape = site["kwargs"].get("sample_shape")
rng_key, subkey = random.split(rng_key)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the subkey is not used so we don't need this line

@fehiepsi fehiepsi requested a review from martinjankowiak June 22, 2021 13:57
@fritzo
Copy link
Member

fritzo commented Jun 23, 2021

Seems like a good idea; we should do this in Pyro too!

@fehiepsi
Copy link
Member Author

@fritzo Could you help me review this pr?

@fehiepsi fehiepsi merged commit cc82781 into pyro-ppl:master Sep 25, 2021
@fehiepsi
Copy link
Member Author

Thanks, Fritz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

raise a better error/warning for init strategies with substituted models
2 participants