Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
42c00fb2
提交
42c00fb2
authored
12月 12, 2015
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make sure to always have at least one user stack trace and don't check the stack for more then one
上级
3adaa82f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
29 行删除
+23
-29
utils.py
theano/gof/utils.py
+23
-29
没有找到文件。
theano/gof/utils.py
浏览文件 @
42c00fb2
...
@@ -10,7 +10,7 @@ from theano import config
...
@@ -10,7 +10,7 @@ from theano import config
from
theano.compat
import
OrderedDict
,
PY3
from
theano.compat
import
OrderedDict
,
PY3
def
simple_extract_stack
(
f
=
None
,
limit
=
None
):
def
simple_extract_stack
(
f
=
None
,
limit
=
None
,
skips
=
[]
):
"""
"""
This is traceback.extract_stack from python 2.7 with this change:
This is traceback.extract_stack from python 2.7 with this change:
...
@@ -19,6 +19,8 @@ def simple_extract_stack(f=None, limit=None):
...
@@ -19,6 +19,8 @@ def simple_extract_stack(f=None, limit=None):
This is because this update cause an call to os.stat to get the
This is because this update cause an call to os.stat to get the
line content. This cause too much long on cluster.
line content. This cause too much long on cluster.
skips - partial path of stack level we don't want to keep and count.
When we find one level that isn't skipped, we stop skipping.
"""
"""
if
f
is
None
:
if
f
is
None
:
try
:
try
:
...
@@ -41,8 +43,20 @@ def simple_extract_stack(f=None, limit=None):
...
@@ -41,8 +43,20 @@ def simple_extract_stack(f=None, limit=None):
line
=
line
.
strip
()
line
=
line
.
strip
()
else
:
else
:
line
=
None
line
=
None
list
.
append
((
filename
,
lineno
,
name
,
line
))
f
=
f
.
f_back
f
=
f
.
f_back
if
len
(
list
)
==
0
:
rm
=
False
for
p
in
skips
:
# Julian: I added the 'tests' exception together with
# Arnaud. Otherwise, we'd lose the stack trace during
# in our test cases (e.g. in test_opt.py). We're not
# sure this is the right way to do it though.
if
p
in
filename
and
'tests'
not
in
filename
:
rm
=
True
break
if
rm
:
continue
list
.
append
((
filename
,
lineno
,
name
,
line
))
n
=
n
+
1
n
=
n
+
1
list
.
reverse
()
list
.
reverse
()
return
list
return
list
...
@@ -76,39 +90,19 @@ def add_tag_trace(thing, user_line=1):
...
@@ -76,39 +90,19 @@ def add_tag_trace(thing, user_line=1):
limit
=
config
.
traceback
.
limit
limit
=
config
.
traceback
.
limit
if
limit
==
-
1
:
if
limit
==
-
1
:
limit
=
None
limit
=
None
tr
=
simple_extract_stack
(
limit
=
limit
)[:
-
1
]
skips
=
[
"theano/tensor/"
,
"theano
\\
tensor
\\
"
,
# Different python version use different sementic for
# limit. python 2.7 include the call to extrack_stack. The -1 get
# rid of it.
# Get rid of Theano internal
while
tr
:
file_path
=
tr
[
-
1
][
0
]
rm
=
False
for
p
in
[
"theano/tensor/"
,
"theano
\\
tensor
\\
"
,
"theano/compile/"
,
"theano
\\
compile
\\
"
,
"theano/compile/"
,
"theano
\\
compile
\\
"
,
"theano/gof/"
,
"theano
\\
gof
\\
"
,
"theano/gof/"
,
"theano
\\
gof
\\
"
,
"theano/scalar/basic.py"
,
"theano
\\
scalar
\\
basic.py"
,
"theano/scalar/basic.py"
,
"theano
\\
scalar
\\
basic.py"
,
"theano/sandbox/"
,
"theano
\\
sandbox
\\
"
,
"theano/sandbox/"
,
"theano
\\
sandbox
\\
"
,
"theano/scan_module/"
,
"theano
\\
scan_module
\\
"
,
"theano/scan_module/"
,
"theano
\\
scan_module
\\
"
,
"theano/sparse/"
,
"theano
\\
sparse
\\
"
,
"theano/sparse/"
,
"theano
\\
sparse
\\
"
,
"theano/typed_list/"
,
"theano
\\
typed_list
\\
"
,
"theano/typed_list/"
,
"theano
\\
typed_list
\\
"
,]
]:
tr
=
simple_extract_stack
(
limit
=
user_line
,
skips
=
skips
)
# Julian: I added the 'tests' exception together with Arnaud.
# Different python version use different sementic for
# Otherwise, we'd lose the stack trace during in our test cases
# limit. python 2.7 include the call to extrack_stack. The -1 get
# (e.g. in test_opt.py). We're not sure this is the right way to
# rid of it.
# do it though.
if
p
in
file_path
and
'tests'
not
in
file_path
:
tr
=
tr
[:
-
1
]
rm
=
True
break
if
not
rm
:
break
# Keep only the most recent stack level.
# The order is from the oldest to the newest
if
len
(
tr
)
>
user_line
:
tr
=
tr
[
-
user_line
:]
if
tr
:
if
tr
:
thing
.
tag
.
trace
=
[
tr
]
thing
.
tag
.
trace
=
[
tr
]
else
:
else
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论