Skip to content
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

Capture non-existent block within a scope, and report a nice error message #683

Open
fsaad opened this issue Jan 21, 2018 · 1 comment
Open
Assignees

Comments

@fsaad
Copy link
Collaborator

fsaad commented Jan 21, 2018

ripl.execute_program('assume x1 = tag("x", "x", normal(0,1))')
ripl.execute_program('assume y1 = tag("y", "y", normal(x1,1))')
ripl.observe('y1', 2)
ripl.execute_program('infer(mh("x", 1, 100))')

The final line crashes noisily since block 1 does not exist in scope "x", leading this dictionary lookup in line 344 to fail:

def getNodesInBlock(self, scope, block, do_copy=True):
#import pdb; pdb.set_trace()
#scope, block = self._normalizeEvaluatedScopeAndBlock(scope, block)
nodes = self.scopes[scope][block]
# Defensively copying the set of nodes, because
# unregisterRandomChoice will mutate them.

@fsaad fsaad self-assigned this Jan 21, 2018
@fsaad
Copy link
Collaborator Author

fsaad commented Jan 21, 2018

Remember to handle the built-in scopes/blocks such as "all", "one", etc.

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

No branches or pull requests

1 participant