提交 56aa741b authored 作者: Nicolas Ballas's avatar Nicolas Ballas

replace gof.vm.raise_with_op by gof.link.raise_with_op

上级 32876587
......@@ -607,7 +607,7 @@ class Function(object):
# For the c linker We don't have access from
# python to all the temps values So for now, we
# just don't print the extra shapes/strides info
gof.vm.raise_with_op(
gof.link.raise_with_op(
self.fn.nodes[self.fn.position_of_error])
else:
# old-style linkers raise their own exceptions
......
......@@ -56,7 +56,7 @@ sys.excepthook = thunk_hook
# TODO: Make this work with linker defined schedule
def raise_with_op(node, thunk=None, exc_info=None):
def raise_with_op(node, thunk=None, exc_info=None, func=None):
"""
Re-raise an exception while annotating the exception object with
debug info.
......
......@@ -52,9 +52,6 @@ AddConfigVar('vm.lazy',
ConfigParam('None', filter_vm_lazy),
in_c_key=False)
raise_with_op = link.raise_with_op
class VM(object):
"""
A VM object's __call__ method evaluates a Theano program.
......@@ -176,7 +173,7 @@ class Loop(VM):
self.call_counts[i] += 1
self.call_times[i] += t1 - t0
except:
raise_with_op(node, thunk)
link.raise_with_op(node, thunk)
else:
for cont in self.pre_call_clear:
cont[0] = None
......@@ -184,7 +181,7 @@ class Loop(VM):
for thunk, node in zip(self.thunks, self.nodes):
thunk()
except:
raise_with_op(node, thunk)
link.raise_with_op(node, thunk)
class LoopGC(VM):
......@@ -216,7 +213,7 @@ class LoopGC(VM):
old_s[0] = None
i += 1
except:
raise_with_op(node, thunk)
link.raise_with_op(node, thunk)
else:
for cont in self.pre_call_clear:
cont[0] = None
......@@ -227,7 +224,7 @@ class LoopGC(VM):
for old_s in old_storage:
old_s[0] = None
except:
raise_with_op(node, thunk)
link.raise_with_op(node, thunk)
class Stack(VM):
......@@ -418,8 +415,8 @@ class Stack(VM):
st = "c"
self.variable_strides[var] = st
except Exception:
raise_with_op(current_apply,
self.thunks[self.node_idx[current_apply]])
link.raise_with_op(current_apply,
self.thunks[self.node_idx[current_apply]])
for o in current_apply.outputs:
compute_map[o][0] = 1
......@@ -486,8 +483,8 @@ class Stack(VM):
self.call_times[current_idx] += dt
except Exception:
raise_with_op(current_apply,
self.thunks[self.node_idx[current_apply]])
link.raise_with_op(current_apply,
self.thunks[self.node_idx[current_apply]])
if requires:
for r in requires:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论