probcomp / Venturecxx

Primary implementation of the Venture probabilistic programming system
http://probcomp.csail.mit.edu/venture/
GNU General Public License v3.0
29 stars 6 forks source link

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

Open fsaad opened 6 years ago

fsaad commented 6 years ago
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: https://github.com/probcomp/Venturecxx/blob/9304f69278c4c1f520453d71647a5c1cfb583e93/backend/lite/trace.py#L341-L346

fsaad commented 6 years ago

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