提交 fb83310e authored 作者: Reyhane Askari's avatar Reyhane Askari

added stack trace to several places

上级 1719e905
......@@ -97,6 +97,7 @@ class Apply(Node):
self.op = op
self.inputs = []
self.tag = utils.scratchpad()
utils.add_tag_trace(self)
if not isinstance(inputs, (list, tuple)):
raise TypeError("The inputs of an Apply must be a list or tuple")
......@@ -117,6 +118,8 @@ class Apply(Node):
if output.owner is None:
output.owner = self
output.index = i
output.tag = utils.scratchpad()
utils.add_tag_trace(output)
elif output.owner is not self or output.index != i:
raise ValueError("All output variables passed to Apply must belong to it.")
self.outputs.append(output)
......
......@@ -613,6 +613,7 @@ class PureOp(object):
"""
return_list = kwargs.pop('return_list', False)
node = self.make_node(*inputs, **kwargs)
utils.add_tag_trace(node)
if config.compute_test_value != 'off':
run_perform = True
......
......@@ -335,9 +335,7 @@ def test_print_op():
assert isinstance(topo[1].op, theano.printing.Print)
assert isinstance(topo[2].op, GpuElemwise)
assert topo[3].op == host_from_gpu
# gpu print_op copies the stack trace
# but _print_fn has an empty stack.
# assert _check_stack_trace(f)
assert _check_stack_trace(f)
f(np.random.random((5, 5)).astype('float32'))
......
......@@ -308,6 +308,8 @@ class Print(Op):
self.message = message
self.attrs = tuple(attrs) # attrs should be a hashable iterable
self.global_fn = global_fn
self.tag = gof.utils.scratchpad()
gof.utils.add_tag_trace(self)
def make_node(self, xin):
xout = xin.type.make_variable()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论