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