提交 3abdc017 authored 作者: Frederic Bastien's avatar Frederic Bastien

added the flag traceback.limit that allow to limit the size of the stack trace.

上级 a3ea318e
...@@ -68,3 +68,7 @@ AddConfigVar('gpuelemwise.sync', ...@@ -68,3 +68,7 @@ AddConfigVar('gpuelemwise.sync',
AddConfigVar('cmodule.mac_framework_link', AddConfigVar('cmodule.mac_framework_link',
"If set to true, breaks certain mac installations with the infamous Bus Error", "If set to true, breaks certain mac installations with the infamous Bus Error",
BoolParam(False)) BoolParam(False))
AddConfigVar('traceback.limit',
"The number of stack to trace. 0 mean all.",
IntParam(0))
...@@ -319,7 +319,9 @@ class PureOp(object): ...@@ -319,7 +319,9 @@ class PureOp(object):
""" """
node = self.make_node(*inputs, **kwargs) node = self.make_node(*inputs, **kwargs)
node.tag.trace = traceback.extract_stack()[:-1] limit = theano.config.traceback.limit
if limit == 0: limit = None
node.tag.trace = traceback.extract_stack(limit=limit)[:-1]
if self.default_output is not None: if self.default_output is not None:
return node.outputs[self.default_output] return node.outputs[self.default_output]
else: else:
......
...@@ -245,7 +245,9 @@ class PureType(object): ...@@ -245,7 +245,9 @@ class PureType(object):
""" """
r = self.make_variable(name) r = self.make_variable(name)
r.tag.trace = traceback.extract_stack()[:-1] if limit == 0: limit = None
node.tag.trace = traceback.extract_stack(limit=limit)[:-1]
r.tag.trace = traceback.extract_stack(limit)[:-1]
return r return r
def values_eq(self, a, b): def values_eq(self, a, b):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论