Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
4182a1ad
提交
4182a1ad
authored
6月 12, 2017
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change docstrings to comments.
上级
4475869c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
12 行增加
和
24 行删除
+12
-24
test_corr3d.py
theano/tensor/nnet/tests/test_corr3d.py
+12
-24
没有找到文件。
theano/tensor/nnet/tests/test_corr3d.py
浏览文件 @
4182a1ad
...
@@ -3,6 +3,8 @@ from __future__ import absolute_import, print_function, division
...
@@ -3,6 +3,8 @@ from __future__ import absolute_import, print_function, division
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.attrib
import
attr
from
nose.plugins.attrib
import
attr
from
nose.tools
import
assert_equals
from
nose.tools
import
assert_equals
from
nose_parameterized
import
parameterized
import
numpy
as
np
import
numpy
as
np
from
six
import
integer_types
from
six
import
integer_types
...
@@ -151,11 +153,9 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -151,11 +153,9 @@ class TestCorr3D(utt.InferShapeTester):
@attr
(
'slow'
)
@attr
(
'slow'
)
def
test_basic
(
self
):
def
test_basic
(
self
):
"""
# Tests that basic correlations work for odd and even
Tests that basic correlations work for odd and even
# dimensions of image and filter shapes, as well as rectangular
dimensions of image and filter shapes, as well as rectangular
# images and filters.
images and filters.
"""
border_modes
=
[
'valid'
,
'full'
,
'half'
,
(
1
,
1
,
1
),
border_modes
=
[
'valid'
,
'full'
,
'half'
,
(
1
,
1
,
1
),
(
2
,
1
,
1
),
(
1
,
2
,
1
),
(
1
,
1
,
2
),
(
2
,
1
,
1
),
(
1
,
2
,
1
),
(
1
,
1
,
2
),
(
3
,
3
,
3
),
1
]
(
3
,
3
,
3
),
1
]
...
@@ -180,9 +180,7 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -180,9 +180,7 @@ class TestCorr3D(utt.InferShapeTester):
@attr
(
'slow'
)
@attr
(
'slow'
)
def
test_subsample
(
self
):
def
test_subsample
(
self
):
"""
# Tests correlation where subsampling != (1,1,1)
Tests correlation where subsampling != (1,1,1)
"""
self
.
validate
((
3
,
2
,
7
,
5
,
5
),
(
2
,
2
,
2
,
3
,
3
),
'valid'
,
subsample
=
(
2
,
2
,
2
))
self
.
validate
((
3
,
2
,
7
,
5
,
5
),
(
2
,
2
,
2
,
3
,
3
),
'valid'
,
subsample
=
(
2
,
2
,
2
))
self
.
validate
((
3
,
2
,
7
,
5
,
5
),
(
2
,
2
,
2
,
3
,
3
),
'valid'
,
subsample
=
(
2
,
1
,
1
))
self
.
validate
((
3
,
2
,
7
,
5
,
5
),
(
2
,
2
,
2
,
3
,
3
),
'valid'
,
subsample
=
(
2
,
1
,
1
))
self
.
validate
((
1
,
1
,
6
,
6
,
6
),
(
1
,
1
,
3
,
3
,
3
),
'valid'
,
subsample
=
(
3
,
3
,
3
))
self
.
validate
((
1
,
1
,
6
,
6
,
6
),
(
1
,
1
,
3
,
3
,
3
),
'valid'
,
subsample
=
(
3
,
3
,
3
))
...
@@ -202,9 +200,7 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -202,9 +200,7 @@ class TestCorr3D(utt.InferShapeTester):
self
.
validate
((
1
,
1
,
6
,
6
,
6
),
(
1
,
1
,
3
,
3
,
3
),
1
,
subsample
=
(
3
,
3
,
3
))
self
.
validate
((
1
,
1
,
6
,
6
,
6
),
(
1
,
1
,
3
,
3
,
3
),
1
,
subsample
=
(
3
,
3
,
3
))
def
test_filter_dilation
(
self
):
def
test_filter_dilation
(
self
):
"""
# Tests correlation where filter dilation != (1,1,1)
Tests correlation where filter dilation != (1,1,1)
"""
self
.
validate
((
3
,
2
,
7
,
5
,
5
),
(
2
,
2
,
2
,
3
,
3
),
'valid'
,
filter_dilation
=
(
2
,
2
,
2
))
self
.
validate
((
3
,
2
,
7
,
5
,
5
),
(
2
,
2
,
2
,
3
,
3
),
'valid'
,
filter_dilation
=
(
2
,
2
,
2
))
self
.
validate
((
3
,
2
,
14
,
10
,
10
),
(
2
,
2
,
2
,
3
,
3
),
'valid'
,
filter_dilation
=
(
3
,
1
,
1
))
self
.
validate
((
3
,
2
,
14
,
10
,
10
),
(
2
,
2
,
2
,
3
,
3
),
'valid'
,
filter_dilation
=
(
3
,
1
,
1
))
self
.
validate
((
1
,
1
,
14
,
14
,
14
),
(
1
,
1
,
3
,
3
,
3
),
'valid'
,
filter_dilation
=
(
2
,
3
,
3
))
self
.
validate
((
1
,
1
,
14
,
14
,
14
),
(
1
,
1
,
3
,
3
,
3
),
'valid'
,
filter_dilation
=
(
2
,
3
,
3
))
...
@@ -242,18 +238,14 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -242,18 +238,14 @@ class TestCorr3D(utt.InferShapeTester):
border_mode
)
border_mode
)
def
test_invalid_filter_shape
(
self
):
def
test_invalid_filter_shape
(
self
):
"""
# Tests scenario where filter_shape[1] != input_shape[1]
Tests scenario where filter_shape[1] != input_shape[1]
"""
self
.
assertRaises
(
ValueError
,
self
.
validate
,
self
.
assertRaises
(
ValueError
,
self
.
validate
,
(
3
,
2
,
8
,
8
,
8
),
(
4
,
3
,
5
,
5
,
8
),
(
3
,
2
,
8
,
8
,
8
),
(
4
,
3
,
5
,
5
,
8
),
'valid'
)
'valid'
)
def
test_full_mode
(
self
):
def
test_full_mode
(
self
):
"""
# Tests basic correlation in full mode and case where filter
Tests basic correlation in full mode and case where filter
# is larger than the input image.
is larger than the input image.
"""
self
.
validate
((
3
,
1
,
4
,
4
,
4
),
(
2
,
1
,
5
,
5
,
5
),
'full'
)
self
.
validate
((
3
,
1
,
4
,
4
,
4
),
(
2
,
1
,
5
,
5
,
5
),
'full'
)
def
f
():
def
f
():
...
@@ -261,9 +253,7 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -261,9 +253,7 @@ class TestCorr3D(utt.InferShapeTester):
self
.
assertRaises
(
Exception
,
f
)
self
.
assertRaises
(
Exception
,
f
)
def
test_wrong_input
(
self
):
def
test_wrong_input
(
self
):
"""
# Make sure errors are raised when image and kernel are not 5D tensors
Make sure errors are raised when image and kernel are not 5D tensors
"""
self
.
assertRaises
(
Exception
,
self
.
validate
,
(
3
,
2
,
8
,
8
,
8
),
(
4
,
2
,
5
,
5
,
5
),
self
.
assertRaises
(
Exception
,
self
.
validate
,
(
3
,
2
,
8
,
8
,
8
),
(
4
,
2
,
5
,
5
,
5
),
'valid'
,
input
=
T
.
dmatrix
())
'valid'
,
input
=
T
.
dmatrix
())
self
.
assertRaises
(
Exception
,
self
.
validate
,
(
3
,
2
,
8
,
8
,
8
),
(
4
,
2
,
5
,
5
,
5
),
self
.
assertRaises
(
Exception
,
self
.
validate
,
(
3
,
2
,
8
,
8
,
8
),
(
4
,
2
,
5
,
5
,
5
),
...
@@ -274,9 +264,7 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -274,9 +264,7 @@ class TestCorr3D(utt.InferShapeTester):
'valid'
,
input
=
T
.
dtensor4
())
'valid'
,
input
=
T
.
dtensor4
())
def
test_dtype_upcast
(
self
):
def
test_dtype_upcast
(
self
):
"""
# Checks dtype upcast for Corr3dMM methods.
Checks dtype upcast for Corr3dMM methods.
"""
if
not
theano
.
config
.
cxx
:
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
raise
SkipTest
(
"Need cxx for this test"
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论