Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
dfec1df1
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dfec1df1
编写于
3月 16, 2018
作者:
K
Kexin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
address comments
上级
8ebfc153
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
87 deletion
+41
-87
python/paddle/fluid/tests/unittests/test_conv2d_op.py
python/paddle/fluid/tests/unittests/test_conv2d_op.py
+19
-33
python/paddle/fluid/tests/unittests/test_pool2d_op.py
python/paddle/fluid/tests/unittests/test_pool2d_op.py
+22
-54
未找到文件。
python/paddle/fluid/tests/unittests/test_conv2d_op.py
浏览文件 @
dfec1df1
...
...
@@ -63,10 +63,11 @@ def conv2d_forward_naive(input, filter, group, conv_param):
class
TestConv2dOp
(
OpTest
):
def
setUp
(
self
):
self
.
op_type
=
"conv2d"
self
.
use_cudnn
=
False
self
.
use_mkldnn
=
False
self
.
dtype
=
np
.
float32
self
.
init_
op
_type
()
self
.
init_
kernel
_type
()
self
.
init_group
()
self
.
init_dilation
()
self
.
init_test_case
()
...
...
@@ -165,8 +166,8 @@ class TestConv2dOp(OpTest):
def
init_group
(
self
):
self
.
groups
=
1
def
init_
op
_type
(
self
):
self
.
op_type
=
"conv2d"
def
init_
kernel
_type
(
self
):
pass
class
TestWithPad
(
TestConv2dOp
):
...
...
@@ -238,15 +239,13 @@ class TestWithInput1x1Filter1x1(TestConv2dOp):
#----------------Conv2dCUDNN----------------
class
TestCUDNN
(
TestConv2dOp
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
class
TestFP16CUDNN
(
TestConv2dOp
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -257,15 +256,13 @@ class TestFP16CUDNN(TestConv2dOp):
class
TestCUDNNWithPad
(
TestWithPad
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
class
TestFP16CUDNNWithPad
(
TestWithPad
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -276,15 +273,13 @@ class TestFP16CUDNNWithPad(TestWithPad):
class
TestCUDNNWithStride
(
TestWithStride
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
class
TestFP16CUDNNWithStride
(
TestWithStride
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -295,15 +290,13 @@ class TestFP16CUDNNWithStride(TestWithStride):
class
TestCUDNNWithGroup
(
TestWithGroup
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
class
TestFP16CUDNNWithGroup
(
TestWithGroup
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -314,15 +307,13 @@ class TestFP16CUDNNWithGroup(TestWithGroup):
class
TestCUDNNWith1x1
(
TestWith1x1
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
class
TestFP16CUDNNWith1x1
(
TestWith1x1
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -333,15 +324,13 @@ class TestFP16CUDNNWith1x1(TestWith1x1):
class
TestCUDNNWithInput1x1Filter1x1
(
TestWithInput1x1Filter1x1
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
class
TestFP16CUDNNWithInput1x1Filter1x1
(
TestWithInput1x1Filter1x1
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"conv2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -384,21 +373,18 @@ class TestDepthwiseConv2(TestConv2dOp):
#----------------Conv2dMKLDNN----------------
class
TestMKLDNN
(
TestConv2dOp
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"conv2d"
class
TestMKLDNNWithPad
(
TestWithPad
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"conv2d"
class
TestMKLDNNWithStride
(
TestWithStride
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"conv2d"
if
__name__
==
'__main__'
:
...
...
python/paddle/fluid/tests/unittests/test_pool2d_op.py
浏览文件 @
dfec1df1
...
...
@@ -78,12 +78,13 @@ def avg_pool2D_forward_naive(x,
class
TestPool2d_Op
(
OpTest
):
def
setUp
(
self
):
self
.
op_type
=
"pool2d"
self
.
use_cudnn
=
False
self
.
use_mkldnn
=
False
self
.
dtype
=
np
.
float32
self
.
init_test_case
()
self
.
init_global_pool
()
self
.
init_
op
_type
()
self
.
init_
kernel
_type
()
self
.
init_pool_type
()
self
.
init_ceil_mode
()
if
self
.
global_pool
:
...
...
@@ -131,8 +132,8 @@ class TestPool2d_Op(OpTest):
self
.
strides
=
[
1
,
1
]
self
.
paddings
=
[
0
,
0
]
def
init_
op
_type
(
self
):
self
.
op_type
=
"pool2d"
def
init_
kernel
_type
(
self
):
pass
def
init_pool_type
(
self
):
self
.
pool_type
=
"avg"
...
...
@@ -152,9 +153,6 @@ class TestCase1(TestPool2d_Op):
self
.
strides
=
[
1
,
1
]
self
.
paddings
=
[
0
,
0
]
def
init_op_type
(
self
):
self
.
op_type
=
"pool2d"
def
init_pool_type
(
self
):
self
.
pool_type
=
"avg"
self
.
pool2D_forward_naive
=
avg_pool2D_forward_naive
...
...
@@ -170,9 +168,6 @@ class TestCase2(TestPool2d_Op):
self
.
strides
=
[
1
,
1
]
self
.
paddings
=
[
1
,
1
]
def
init_op_type
(
self
):
self
.
op_type
=
"pool2d"
def
init_pool_type
(
self
):
self
.
pool_type
=
"avg"
self
.
pool2D_forward_naive
=
avg_pool2D_forward_naive
...
...
@@ -182,27 +177,18 @@ class TestCase2(TestPool2d_Op):
class
TestCase3
(
TestPool2d_Op
):
def
init_op_type
(
self
):
self
.
op_type
=
"pool2d"
def
init_pool_type
(
self
):
self
.
pool_type
=
"max"
self
.
pool2D_forward_naive
=
max_pool2D_forward_naive
class
TestCase4
(
TestCase1
):
def
init_op_type
(
self
):
self
.
op_type
=
"pool2d"
def
init_pool_type
(
self
):
self
.
pool_type
=
"max"
self
.
pool2D_forward_naive
=
max_pool2D_forward_naive
class
TestCase5
(
TestCase2
):
def
init_op_type
(
self
):
self
.
op_type
=
"pool2d"
def
init_pool_type
(
self
):
self
.
pool_type
=
"max"
self
.
pool2D_forward_naive
=
max_pool2D_forward_naive
...
...
@@ -210,15 +196,13 @@ class TestCase5(TestCase2):
#--------------------test pool2d--------------------
class
TestCUDNNCase1
(
TestPool2d_Op
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
class
TestFP16CUDNNCase1
(
TestPool2d_Op
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -229,15 +213,13 @@ class TestFP16CUDNNCase1(TestPool2d_Op):
class
TestCUDNNCase2
(
TestCase1
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
class
TestFP16CUDNNCase2
(
TestCase1
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -248,15 +230,13 @@ class TestFP16CUDNNCase2(TestCase1):
class
TestCUDNNCase3
(
TestCase2
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
class
TestFP16CUDNNCase3
(
TestCase2
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -267,15 +247,13 @@ class TestFP16CUDNNCase3(TestCase2):
class
TestCUDNNCase4
(
TestCase3
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
class
TestFP16CUDNNCase4
(
TestCase3
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -286,15 +264,13 @@ class TestFP16CUDNNCase4(TestCase3):
class
TestCUDNNCase5
(
TestCase4
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
class
TestFP16CUDNNCase5
(
TestCase4
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -305,15 +281,13 @@ class TestFP16CUDNNCase5(TestCase4):
class
TestCUDNNCase6
(
TestCase5
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
class
TestFP16CUDNNCase6
(
TestCase5
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_cudnn
=
True
self
.
op_type
=
"pool2d"
self
.
dtype
=
np
.
float16
def
test_check_output
(
self
):
...
...
@@ -345,39 +319,33 @@ class TestCeilModeCase4(TestCase2):
#--------------------test pool2d MKLDNN--------------------
class
TestMKLDNNCase1
(
TestPool2d_Op
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"pool2d"
class
TestMKLDNNCase2
(
TestCase1
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"pool2d"
class
TestMKLDNNCase3
(
TestCase2
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"pool2d"
class
TestMKLDNNCase4
(
TestCase3
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"pool2d"
class
TestMKLDNNCase5
(
TestCase4
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"pool2d"
class
TestMKLDNNCase6
(
TestCase5
):
def
init_
op
_type
(
self
):
def
init_
kernel
_type
(
self
):
self
.
use_mkldnn
=
True
self
.
op_type
=
"pool2d"
if
__name__
==
'__main__'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录