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

error message for misplaced assume statement. #672

Open
Schaechtle opened this issue May 18, 2017 · 0 comments
Open

error message for misplaced assume statement. #672

Schaechtle opened this issue May 18, 2017 · 0 comments

Comments

@Schaechtle
Copy link
Collaborator

Schaechtle commented May 18, 2017

The following bug (forgot to delete assume):

    ripl = shortcuts.make_lite_ripl()
    ripl.execute_program('''
    assume my_normal = () -> {
        assume x =  1;
        normal(0,1)

    }
    ''')
    ripl.sample('my_normal()')

Throws this uninformative error message:

../venv/local/lib/python2.7/site-packages/venture/ripl/ripl.py:897: in sample
    value = self.execute_instruction(i)['value']
../venv/local/lib/python2.7/site-packages/venture/ripl/ripl.py:274: in execute_instruction
    self._raise_annotated(e, instruction)
../venv/local/lib/python2.7/site-packages/venture/ripl/ripl.py:270: in execute_instruction
    stringable_instruction)
../venv/local/lib/python2.7/site-packages/venture/ripl/ripl.py:285: in _execute_parsed_instruction
    ans = self.sivm.execute_instruction(parsed_instruction)
../venv/local/lib/python2.7/site-packages/venture/sivm/venture_sivm.py:92: in execute_instruction
    return f(instruction)
../venv/local/lib/python2.7/site-packages/venture/sivm/venture_sivm.py:469: in _do_sample
    o1 = self._call_core_sivm_instruction(inst1)
../venv/local/lib/python2.7/site-packages/venture/sivm/venture_sivm.py:193: in _call_core_sivm_instruction
    response = self.core_sivm.execute_instruction(desugared_instruction)
../venv/local/lib/python2.7/site-packages/venture/sivm/core_sivm.py:63: in execute_instruction
    return f(instruction)
../venv/local/lib/python2.7/site-packages/venture/sivm/core_sivm.py:144: in _do_predict
    did, val = self.engine.predict(exp)
../venv/local/lib/python2.7/site-packages/venture/engine/engine.py:100: in predict
    (did, answers) = self.predict_all(datum)
../venv/local/lib/python2.7/site-packages/venture/engine/engine.py:96: in predict_all
    values = self.model.evaluate(baseAddr, datum)
../venv/local/lib/python2.7/site-packages/venture/engine/trace_set.py:152: in evaluate
    return self.traces.map('evaluate', baseAddr, datum)
../venv/local/lib/python2.7/site-packages/venture/multiprocess.py:197: in map
    for pipe in self.pipes: pipe.send((cmd, args, kwargs, None))
../venv/local/lib/python2.7/site-packages/venture/multiprocess.py:565: in send
    self.other.emplace(obj)
../venv/local/lib/python2.7/site-packages/venture/multiprocess.py:570: in emplace
    cb()
../venv/local/lib/python2.7/site-packages/venture/multiprocess.py:378: in poll
    res = [getattr(o, cmd)(*args, **kwargs) for o in self.objs]
../venv/local/lib/python2.7/site-packages/venture/multiprocess.py:351: in <lambda>
    return lambda *args, **kwargs: Success(getattr(self.obj, attrname)(*args, **kwargs))
../venv/local/lib/python2.7/site-packages/venture/engine/trace.py:62: in evaluate
    self.trace.eval(baseAddr,exp)
../venv/local/lib/python2.7/site-packages/venture/lite/trace.py:401: in eval
    Scaffold(), False, OmegaDB(), OrderedDict())
../venv/local/lib/python2.7/site-packages/venture/lite/regen.py:207: in evalFamily
    shouldRestore, omegaDB, gradients)
../venv/local/lib/python2.7/site-packages/venture/lite/regen.py:233: in apply
    shouldRestore, omegaDB, gradients)
../venv/local/lib/python2.7/site-packages/venture/lite/regen.py:298: in evalRequests
    shouldRestore, omegaDB, gradients)
../venv/local/lib/python2.7/site-packages/venture/lite/regen.py:199: in evalFamily
    shouldRestore, omegaDB, gradients)
../venv/local/lib/python2.7/site-packages/venture/lite/regen.py:180: in evalFamily
    sourceNode = env.findSymbol(exp)
../venv/local/lib/python2.7/site-packages/venture/lite/env.py:72: in findSymbol
    else: ret = self.outerEnv.findSymbol(sym)
../venv/local/lib/python2.7/site-packages/venture/lite/env.py:72: in findSymbol
    else: ret = self.outerEnv.findSymbol(sym)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <venture.lite.env.VentureEnvironment object at 0x7f0372a94ad0>, sym = 'bind_'

    def findSymbol(self,sym):
      # type: (str) -> T
      if sym in self.frame: ret = self.frame[sym]
      elif not self.outerEnv: ret = None
      else: ret = self.outerEnv.findSymbol(sym)
      if ret is None:
>       raise VentureError("Cannot find symbol '%s'" % sym)
E       VentureException: *** evaluation: Cannot find symbol 'bind_'
E       (my_normal)
E       ^^^^^^^^^^^
E       (make_csp (quote ()) (quote (bind_ (_assume (quote x) (quote 1.0)) (make_csp (quote ()) (quote (normal 0.0 1.0))))))
E                                    ^^^^^

../venv/local/lib/python2.7/site-packages/venture/lite/env.py:74: VentureException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants