Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
006eaf78
提交
006eaf78
authored
2月 24, 2012
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enables specifying batch size
上级
e88dfffe
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
31 行增加
和
10 行删除
+31
-10
theano-nose
bin/theano-nose
+21
-3
run_tests_in_batch.py
theano/tests/run_tests_in_batch.py
+10
-7
没有找到文件。
bin/theano-nose
浏览文件 @
006eaf78
...
...
@@ -29,11 +29,29 @@ import sys
def
main
():
if
'--batch'
in
sys
.
argv
:
# Handle --batch[=n] arguments
batch_args
=
[
arg
for
arg
in
sys
.
argv
if
arg
.
startswith
(
'--batch'
)]
for
arg
in
batch_args
:
sys
.
argv
.
remove
(
arg
)
if
len
(
batch_args
):
if
len
(
batch_args
)
>
1
:
_logger
.
warn
(
'Multiple --batch arguments detected, using the last one '
'and ignoring the first ones.'
)
batch_arg
=
batch_args
[
-
1
]
elems
=
batch_arg
.
split
(
'='
,
1
)
if
len
(
elems
)
==
2
:
batch_size
=
int
(
elems
[
1
])
else
:
# Use run_tests_in_batch's default
batch_size
=
None
from
theano.tests
import
run_tests_in_batch
sys
.
argv
.
remove
(
'--batch'
)
return
run_tests_in_batch
.
main
()
return
run_tests_in_batch
.
main
(
batch_size
=
batch_size
)
# Non-batch mode.
addplugins
=
[]
# We include KnownFailure plugin by default, unless
# it is disabled by the "--without-knownfailure" arg.
...
...
theano/tests/run_tests_in_batch.py
浏览文件 @
006eaf78
...
...
@@ -36,7 +36,7 @@ import cPickle, os, subprocess, sys
import
theano
def
main
(
stdout
=
None
,
stderr
=
None
,
argv
=
None
,
theano_nose
=
None
):
def
main
(
stdout
=
None
,
stderr
=
None
,
argv
=
None
,
theano_nose
=
None
,
batch_size
=
None
):
"""
Run tests with optional output redirection.
...
...
@@ -48,6 +48,8 @@ def main(stdout=None, stderr=None, argv=None, theano_nose=None):
If theano_nose is None, then we use the theano-nose script found in
Theano/bin to call nosetests. Otherwise we call the provided script.
If batch_size is None, we use a default value of 100.
"""
if
stdout
is
None
:
stdout
=
sys
.
stdout
...
...
@@ -57,17 +59,19 @@ def main(stdout=None, stderr=None, argv=None, theano_nose=None):
argv
=
sys
.
argv
if
theano_nose
is
None
:
theano_nose
=
os
.
path
.
join
(
theano
.
__path__
[
0
],
'..'
,
'bin'
,
'theano-nose'
)
if
batch_size
is
None
:
batch_size
=
100
stdout_backup
=
sys
.
stdout
stderr_backup
=
sys
.
stderr
try
:
sys
.
stdout
=
stdout
sys
.
stderr
=
stderr
run
(
stdout
,
stderr
,
argv
,
theano_nose
)
run
(
stdout
,
stderr
,
argv
,
theano_nose
,
batch_size
)
finally
:
sys
.
stdout
=
stdout_backup
sys
.
stderr
=
stderr_backup
def
run
(
stdout
,
stderr
,
argv
,
theano_nose
):
def
run
(
stdout
,
stderr
,
argv
,
theano_nose
,
batch_size
):
if
len
(
argv
)
==
1
:
tests_dir
=
theano
.
__path__
[
0
]
else
:
...
...
@@ -101,16 +105,15 @@ def run(stdout, stderr, argv, theano_nose):
n_tests
=
len
(
ids
)
assert
n_tests
==
max
(
ids
)
# Run tests.
n_batch
=
100
failed
=
set
()
print
"""
\
###################################
# RUNNING TESTS IN BATCHES OF
%
s #
###################################"""
%
n_batch
for
test_id
in
xrange
(
1
,
n_tests
+
1
,
n_batch
):
###################################"""
%
batch_size
for
test_id
in
xrange
(
1
,
n_tests
+
1
,
batch_size
):
stdout
.
flush
()
stderr
.
flush
()
test_range
=
range
(
test_id
,
min
(
test_id
+
n_batch
,
n_tests
+
1
))
test_range
=
range
(
test_id
,
min
(
test_id
+
batch_size
,
n_tests
+
1
))
# We suppress all output because we want the user to focus only on the
# failed tests, which are re-run (with output) below.
dummy_out
=
open
(
os
.
devnull
,
'w'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论