提交 c6e55759 authored 作者: Frederic's avatar Frederic

Remove internal Theano stack level from variable creating. This make them more…

Remove internal Theano stack level from variable creating. This make them more readable to the user.
上级 7f593947
...@@ -18,6 +18,18 @@ def add_tag_trace(thing): ...@@ -18,6 +18,18 @@ def add_tag_trace(thing):
# rid of it. We also want to get rid of the add_tag_trace call. # rid of it. We also want to get rid of the add_tag_trace call.
if tr and "add_tag_trace" in tr[-1][-1]: if tr and "add_tag_trace" in tr[-1][-1]:
tr = tr[:-1] tr = tr[:-1]
while tr:
file_path = tr[-1][0]
rm = False
for p in ["theano/tensor/",
"theano/gof/"]:
if p in file_path:
tr = tr[:-1]
rm = True
break
if not rm:
break
thing.tag.trace = tr thing.tag.trace = tr
return thing return thing
......
...@@ -600,6 +600,7 @@ class TensorVariable(_tensor_py_operators, Variable): ...@@ -600,6 +600,7 @@ class TensorVariable(_tensor_py_operators, Variable):
x = x[:-1] x = x[:-1]
nb_rm += 1 nb_rm += 1
rm = True rm = True
break
if not rm: if not rm:
break break
warnings.warn(msg, stacklevel=1 + nb_rm) warnings.warn(msg, stacklevel=1 + nb_rm)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论