Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3796417a
提交
3796417a
authored
6月 29, 2017
作者:
abergeron
提交者:
GitHub
6月 29, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6084 from nouiz/tests
speed up tests, fix compiledir cache crash and old unpickling.
上级
a2632169
fc2b9fc0
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
21 行增加
和
8 行删除
+21
-8
cmodule.py
theano/gof/cmodule.py
+8
-0
compiledir.py
theano/gof/compiledir.py
+5
-1
type.py
theano/gof/type.py
+2
-1
test_bn.py
theano/tensor/nnet/tests/test_bn.py
+2
-2
test_extra_ops.py
theano/tensor/tests/test_extra_ops.py
+4
-4
没有找到文件。
theano/gof/cmodule.py
浏览文件 @
3796417a
...
@@ -447,6 +447,10 @@ def get_safe_part(key):
...
@@ -447,6 +447,10 @@ def get_safe_part(key):
# Find the md5 hash part.
# Find the md5 hash part.
c_link_key
=
key
[
1
]
c_link_key
=
key
[
1
]
# In case in the future, we don't have an md5 part and we have
# such stuff in the cache. In that case, we can set None, and the
# rest of the cache mechanism will just skip that key.
md5
=
None
for
key_element
in
c_link_key
[
1
:]:
for
key_element
in
c_link_key
[
1
:]:
if
(
isinstance
(
key_element
,
string_types
)
and
if
(
isinstance
(
key_element
,
string_types
)
and
key_element
.
startswith
(
'md5:'
)):
key_element
.
startswith
(
'md5:'
)):
...
@@ -743,7 +747,11 @@ class ModuleCache(object):
...
@@ -743,7 +747,11 @@ class ModuleCache(object):
time_now
=
time
.
time
()
time_now
=
time
.
time
()
# Go through directories in alphabetical order to ensure consistent
# Go through directories in alphabetical order to ensure consistent
# behavior.
# behavior.
try
:
subdirs
=
sorted
(
os
.
listdir
(
self
.
dirname
))
subdirs
=
sorted
(
os
.
listdir
(
self
.
dirname
))
except
OSError
:
# This can happen if the dir don't exist.
subdirs
=
[]
files
,
root
=
None
,
None
# To make sure the "del" below works
files
,
root
=
None
,
None
# To make sure the "del" below works
for
subdirs_elem
in
subdirs
:
for
subdirs_elem
in
subdirs
:
# Never clean/remove lock_dir
# Never clean/remove lock_dir
...
...
theano/gof/compiledir.py
浏览文件 @
3796417a
...
@@ -77,7 +77,7 @@ def cleanup():
...
@@ -77,7 +77,7 @@ def cleanup():
if
len
(
keydata
.
keys
)
==
0
:
if
len
(
keydata
.
keys
)
==
0
:
shutil
.
rmtree
(
os
.
path
.
join
(
compiledir
,
directory
))
shutil
.
rmtree
(
os
.
path
.
join
(
compiledir
,
directory
))
except
EOFError
:
except
(
EOFError
,
AttributeError
)
:
_logger
.
error
(
_logger
.
error
(
"Could not read key file '
%
s'. To complete "
"Could not read key file '
%
s'. To complete "
"the clean-up, please remove manually "
"the clean-up, please remove manually "
...
@@ -159,6 +159,10 @@ def print_compiledir_content():
...
@@ -159,6 +159,10 @@ def print_compiledir_content():
nb_keys
[
len
(
keydata
.
keys
)]
+=
1
nb_keys
[
len
(
keydata
.
keys
)]
+=
1
except
IOError
:
except
IOError
:
pass
pass
except
AttributeError
:
_logger
.
error
(
"Could not read key file '
%
s'."
,
filename
)
print_title
(
"Theano cache:
%
s"
%
compiledir
,
overline
=
'='
,
underline
=
'='
)
print_title
(
"Theano cache:
%
s"
%
compiledir
,
overline
=
'='
,
underline
=
'='
)
print
()
print
()
...
...
theano/gof/type.py
浏览文件 @
3796417a
...
@@ -803,7 +803,8 @@ if (py_%(name)s == NULL) { %(freefunc)s(%(name)s); }
...
@@ -803,7 +803,8 @@ if (py_%(name)s == NULL) { %(freefunc)s(%(name)s); }
self
.
header_dirs
=
()
self
.
header_dirs
=
()
self
.
libraries
=
()
self
.
libraries
=
()
self
.
lib_dirs
=
()
self
.
lib_dirs
=
()
self
.
extra_support_code
=
""
if
not
hasattr
(
self
,
'version'
):
self
.
version
=
None
class
CDataTypeConstant
(
graph
.
Constant
):
class
CDataTypeConstant
(
graph
.
Constant
):
...
...
theano/tensor/nnet/tests/test_bn.py
浏览文件 @
3796417a
...
@@ -147,7 +147,7 @@ def test_batch_normalization_train():
...
@@ -147,7 +147,7 @@ def test_batch_normalization_train():
utt
.
seed_rng
()
utt
.
seed_rng
()
for
axes
in
(
'per-activation'
,
'spatial'
,
(
1
,
2
,
3
,
4
)):
for
axes
in
(
'per-activation'
,
'spatial'
,
(
1
,
2
,
3
,
4
)):
for
vartype
in
(
T
.
tensor5
,
T
.
tensor
4
,
T
.
tensor3
,
T
.
matrix
,
T
.
vector
):
for
vartype
in
(
T
.
tensor5
,
T
.
tensor
3
,
T
.
vector
):
x
,
scale
,
bias
,
running_mean
,
running_var
=
(
vartype
(
n
)
x
,
scale
,
bias
,
running_mean
,
running_var
=
(
vartype
(
n
)
for
n
in
(
'x'
,
'scale'
,
'bias'
,
for
n
in
(
'x'
,
'scale'
,
'bias'
,
'running_mean'
,
'running_mean'
,
...
@@ -338,7 +338,7 @@ def test_batch_normalization_train_broadcast():
...
@@ -338,7 +338,7 @@ def test_batch_normalization_train_broadcast():
def
test_batch_normalization_test
():
def
test_batch_normalization_test
():
for
axes
in
(
'per-activation'
,
'spatial'
,
(
1
,
2
,
3
,
4
)):
for
axes
in
(
'per-activation'
,
'spatial'
,
(
1
,
2
,
3
,
4
)):
for
vartype
in
(
T
.
tensor5
,
T
.
tensor
4
,
T
.
tensor3
,
T
.
matrix
,
T
.
vector
):
for
vartype
in
(
T
.
tensor5
,
T
.
tensor
3
,
T
.
vector
):
x
,
scale
,
bias
,
mean
,
var
=
(
vartype
(
n
)
x
,
scale
,
bias
,
mean
,
var
=
(
vartype
(
n
)
for
n
in
(
'x'
,
'scale'
,
'bias'
,
'mean'
,
'var'
))
for
n
in
(
'x'
,
'scale'
,
'bias'
,
'mean'
,
'var'
))
ndim
=
x
.
ndim
ndim
=
x
.
ndim
...
...
theano/tensor/tests/test_extra_ops.py
浏览文件 @
3796417a
...
@@ -380,7 +380,7 @@ class TestRepeatOp(utt.InferShapeTester):
...
@@ -380,7 +380,7 @@ class TestRepeatOp(utt.InferShapeTester):
self
.
numpy_unsupported_dtypes
=
(
'uint32'
,
'int64'
,
'uint64'
)
self
.
numpy_unsupported_dtypes
=
(
'uint32'
,
'int64'
,
'uint64'
)
def
test_repeatOp
(
self
):
def
test_repeatOp
(
self
):
for
ndim
in
range
(
3
)
:
for
ndim
in
[
1
,
3
]
:
x
=
T
.
TensorType
(
config
.
floatX
,
[
False
]
*
ndim
)()
x
=
T
.
TensorType
(
config
.
floatX
,
[
False
]
*
ndim
)()
a
=
np
.
random
.
random
((
10
,
)
*
ndim
)
.
astype
(
config
.
floatX
)
a
=
np
.
random
.
random
((
10
,
)
*
ndim
)
.
astype
(
config
.
floatX
)
...
@@ -438,13 +438,13 @@ class TestRepeatOp(utt.InferShapeTester):
...
@@ -438,13 +438,13 @@ class TestRepeatOp(utt.InferShapeTester):
@attr
(
'slow'
)
@attr
(
'slow'
)
def
test_infer_shape
(
self
):
def
test_infer_shape
(
self
):
for
ndim
in
range
(
4
)
:
for
ndim
in
[
1
,
3
]
:
x
=
T
.
TensorType
(
config
.
floatX
,
[
False
]
*
ndim
)()
x
=
T
.
TensorType
(
config
.
floatX
,
[
False
]
*
ndim
)()
shp
=
(
np
.
arange
(
ndim
)
+
1
)
*
5
shp
=
(
np
.
arange
(
ndim
)
+
1
)
*
3
a
=
np
.
random
.
random
(
shp
)
.
astype
(
config
.
floatX
)
a
=
np
.
random
.
random
(
shp
)
.
astype
(
config
.
floatX
)
for
axis
in
self
.
_possible_axis
(
ndim
):
for
axis
in
self
.
_possible_axis
(
ndim
):
for
dtype
in
tensor
.
integer_dtypes
:
for
dtype
in
[
"int8"
,
"uint8"
,
"uint64"
]
:
r_var
=
T
.
scalar
(
dtype
=
dtype
)
r_var
=
T
.
scalar
(
dtype
=
dtype
)
r
=
np
.
asarray
(
3
,
dtype
=
dtype
)
r
=
np
.
asarray
(
3
,
dtype
=
dtype
)
if
dtype
in
self
.
numpy_unsupported_dtypes
:
if
dtype
in
self
.
numpy_unsupported_dtypes
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论