Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c482805d
提交
c482805d
authored
12月 14, 2015
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Run conv2d tests with the default interface as well
上级
b9c51f28
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
40 行增加
和
21 行删除
+40
-21
test_conv.py
theano/tensor/nnet/tests/test_conv.py
+40
-21
没有找到文件。
theano/tensor/nnet/tests/test_conv.py
浏览文件 @
c482805d
...
@@ -13,8 +13,14 @@ from theano.tests.unittest_tools import attr
...
@@ -13,8 +13,14 @@ from theano.tests.unittest_tools import attr
class
TestConv2D
(
utt
.
InferShapeTester
):
class
TestConv2D
(
utt
.
InferShapeTester
):
# This class contains tests for the legacy 2d convolution,
# but will also be inherited from for other implementations
mode
=
None
mode
=
None
dtype
=
theano
.
config
.
floatX
dtype
=
theano
.
config
.
floatX
# This will be set to the appropriate function in the inherited classes.
# The call to `staticmethod` is necessary to prevent Python from passing
# `self` as the first argument.
conv2d
=
staticmethod
(
conv
.
conv2d
)
def
setUp
(
self
):
def
setUp
(
self
):
super
(
TestConv2D
,
self
)
.
setUp
()
super
(
TestConv2D
,
self
)
.
setUp
()
...
@@ -435,7 +441,7 @@ class TestConv2D(utt.InferShapeTester):
...
@@ -435,7 +441,7 @@ class TestConv2D(utt.InferShapeTester):
input
=
theano
.
shared
(
numpy
.
random
.
random
(
image_shape
))
input
=
theano
.
shared
(
numpy
.
random
.
random
(
image_shape
))
filters
=
theano
.
shared
(
numpy
.
random
.
random
(
filter_shape
))
filters
=
theano
.
shared
(
numpy
.
random
.
random
(
filter_shape
))
output
=
conv
.
conv2d
(
input
,
filters
,
output
=
self
.
conv2d
(
input
,
filters
,
image_shape
,
filter_shape
,
image_shape
,
filter_shape
,
border_mode
,
border_mode
,
unroll_patch
=
True
,
unroll_patch
=
True
,
...
@@ -465,62 +471,75 @@ class TestConv2D(utt.InferShapeTester):
...
@@ -465,62 +471,75 @@ class TestConv2D(utt.InferShapeTester):
adtens_val
=
rand
(
*
aivec_val
)
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
aivec_val
=
[
6
,
2
,
8
,
3
]
aivec_val
=
[
6
,
2
,
8
,
3
]
bivec_val
=
[
4
,
2
,
5
,
3
]
bivec_val
=
[
4
,
2
,
5
,
3
]
adtens_val
=
rand
(
*
aivec_val
)
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
aivec_val
=
[
3
,
6
,
7
,
5
]
aivec_val
=
[
3
,
6
,
7
,
5
]
bivec_val
=
[
5
,
6
,
3
,
2
]
bivec_val
=
[
5
,
6
,
3
,
2
]
adtens_val
=
rand
(
*
aivec_val
)
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
aivec_val
=
[
3
,
6
,
7
,
5
]
aivec_val
=
[
3
,
6
,
7
,
5
]
bivec_val
=
[
5
,
6
,
2
,
3
]
bivec_val
=
[
5
,
6
,
2
,
3
]
adtens_val
=
rand
(
*
aivec_val
)
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
aivec_val
=
[
5
,
2
,
4
,
3
]
aivec_val
=
[
5
,
2
,
4
,
3
]
bivec_val
=
[
6
,
2
,
4
,
3
]
bivec_val
=
[
6
,
2
,
4
,
3
]
adtens_val
=
rand
(
*
aivec_val
)
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'valid'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
self
.
_compile_and_check
([
adtens
,
bdtens
],
self
.
_compile_and_check
([
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
)
border_mode
=
'full'
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
'conv_gemm'
])
class
TestDefaultConv2D
(
TestConv2D
):
conv2d
=
staticmethod
(
theano
.
tensor
.
nnet
.
conv2d
)
# Test that broadcasting of gradients works correctly when using the
# Test that broadcasting of gradients works correctly when using the
# nnet.conv2d() interface. This was reported in #3763, and uses the example
# nnet.conv2d() interface. This was reported in #3763, and uses the example
# code from that ticket.
# code from that ticket.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论