提交 46865976 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

better error reporting for scan

If there is an error in the inner graph, without this change in the CVM you do not get a message saying what was wrong.
上级 c964257d
...@@ -730,7 +730,17 @@ class Scan(PureOp): ...@@ -730,7 +730,17 @@ class Scan(PureOp):
output_storage[pdx].storage[0] = None output_storage[pdx].storage[0] = None
# 5. compute outputs # 5. compute outputs
t0_fn = time.time() t0_fn = time.time()
fn() try:
fn()
except Exception:
if hasattr(fn, 'position_of_error'):
# this is a new vm-provided function
# the C VM needs this because the exception manipulation
# done by raise_with_op is not implemented in C.
gof.vm.raise_with_op(fn.nodes[fn.position_of_error])
else:
# old-style linkers raise their own exceptions
raise
dt_fn = time.time() - t0_fn dt_fn = time.time() - t0_fn
if self.as_while: if self.as_while:
pdx = offset + self.n_shared_outs pdx = offset + self.n_shared_outs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论