Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
8efd0876
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8efd0876
编写于
10月 30, 2017
作者:
C
chengduo
提交者:
GitHub
10月 30, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5187 from chengduoZH/fix_pool_op
fix pool op
上级
0049ce04
6bdf5c14
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
109 addition
and
75 deletion
+109
-75
paddle/operators/pool_cudnn_op.cu
paddle/operators/pool_cudnn_op.cu
+4
-1
paddle/operators/pool_op.cc
paddle/operators/pool_op.cc
+26
-19
paddle/operators/pool_op.h
paddle/operators/pool_op.h
+6
-1
paddle/operators/pool_with_index_op.cc
paddle/operators/pool_with_index_op.cc
+37
-28
paddle/operators/pool_with_index_op.h
paddle/operators/pool_with_index_op.h
+4
-0
python/paddle/v2/framework/tests/test_pool2d_op.py
python/paddle/v2/framework/tests/test_pool2d_op.py
+4
-1
python/paddle/v2/framework/tests/test_pool3d_op.py
python/paddle/v2/framework/tests/test_pool3d_op.py
+11
-8
python/paddle/v2/framework/tests/test_pool_max_op.py
python/paddle/v2/framework/tests/test_pool_max_op.py
+17
-17
未找到文件。
paddle/operators/pool_cudnn_op.cu
浏览文件 @
8efd0876
...
...
@@ -43,6 +43,7 @@ class PoolCudnnOpKernel : public framework::OpKernel<T> {
std
::
vector
<
int
>
paddings
=
ctx
.
Attr
<
std
::
vector
<
int
>>
(
"paddings"
);
if
(
ctx
.
Attr
<
bool
>
(
"globalPooling"
))
{
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
paddings
[
i
]
=
0
;
ksize
[
i
]
=
static_cast
<
int
>
(
input
->
dims
()[
i
+
2
]);
}
}
...
...
@@ -97,8 +98,10 @@ class PoolCudnnGradOpKernel : public framework::OpKernel<T> {
std
::
vector
<
int
>
paddings
=
ctx
.
Attr
<
std
::
vector
<
int
>>
(
"paddings"
);
if
(
ctx
.
Attr
<
bool
>
(
"globalPooling"
))
{
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
paddings
[
i
]
=
0
;
ksize
[
i
]
=
static_cast
<
int
>
(
input
->
dims
()[
i
+
2
]);
}
}
const
T
*
input_data
=
input
->
data
<
T
>
();
...
...
paddle/operators/pool_op.cc
浏览文件 @
8efd0876
...
...
@@ -39,8 +39,10 @@ void PoolOp::InferShape(framework::InferShapeContext *ctx) const {
if
(
ctx
->
Attrs
().
Get
<
bool
>
(
"globalPooling"
))
{
ksize
.
resize
(
static_cast
<
size_t
>
(
in_x_dims
.
size
())
-
2
);
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
paddings
[
i
]
=
0
;
ksize
[
i
]
=
static_cast
<
int
>
(
in_x_dims
[
i
+
2
]);
}
}
PADDLE_ENFORCE
(
in_x_dims
.
size
()
-
ksize
.
size
()
==
2U
,
...
...
@@ -84,15 +86,16 @@ Pool2dOpMaker::Pool2dOpMaker(framework::OpProto *proto,
"(string), pooling type, can be
\"
max
\"
for max-pooling "
"and
\"
avg
\"
for average-pooling."
)
.
InEnum
({
"max"
,
"avg"
});
AddAttr
<
std
::
vector
<
int
>>
(
"ksize"
,
"(vector ), the pooling window size(height, width) of pooling operator."
"If globalPooling = true, ksize is ignored and need not be "
"specified."
);
// TODO(Chengduo): Add checker. (Currently,
AddAttr
<
std
::
vector
<
int
>>
(
"ksize"
,
"(vector ), the pooling window size(height, width) "
"of pooling operator."
"If globalPooling = true, ksize and paddings will "
"be ignored."
);
// TODO(Chengduo): Add checker.
// (Currently,
// TypedAttrChecker don't support vector type.)
AddAttr
<
bool
>
(
"globalPooling"
,
"(bool default: false), whether to use the global pooling."
"If globalPooling = true, ksize
is
ignored."
)
"If globalPooling = true, ksize
and paddings will be
ignored."
)
.
SetDefault
(
false
);
AddAttr
<
std
::
vector
<
int
>>
(
"strides"
,
...
...
@@ -101,7 +104,8 @@ Pool2dOpMaker::Pool2dOpMaker(framework::OpProto *proto,
// TypedAttrChecker don't support vector type.)
AddAttr
<
std
::
vector
<
int
>>
(
"paddings"
,
"(vector defalut:{0,0}), paddings(height, width) of pooling operator."
)
"(vector defalut:{0,0}), paddings(height, width) of pooling operator."
"If globalPooling = true, paddings and ksize will be ignored."
)
.
SetDefault
({
0
,
0
});
// TODO(Chengduo): Add checker. (Currently,
// TypedAttrChecker don't support vector type.)
...
...
@@ -145,25 +149,28 @@ Pool3dOpMaker::Pool3dOpMaker(framework::OpProto *proto,
"(string), pooling type, can be
\"
max
\"
for max-pooling "
"and
\"
avg
\"
for average-pooling."
)
.
InEnum
({
"max"
,
"avg"
});
AddAttr
<
std
::
vector
<
int
>>
(
"ksize"
,
"(vector ), the pooling window size(depth, height, width) of pooling "
"operator."
"If globalPooling = true, ksize is ignored and need not be "
"specified."
);
// TODO(Chengduo): Add checker. (Currently,
// TypedAttrChecker don't support vector type.)
AddAttr
<
std
::
vector
<
int
>>
(
"ksize"
,
"(vector ), the pooling window size(depth, height, "
"width) of pooling "
"operator."
"If globalPooling = true, ksize and paddings wille "
"be ignored."
);
// TODO(Chengduo): Add checker.
// (Currently,
// TypedAttrChecker don't support vector type.)
AddAttr
<
bool
>
(
"globalPooling"
,
"(bool default: false), whether to use the global pooling."
"If globalPooling = true, ksize
is
ignored."
)
"If globalPooling = true, ksize
and paddings wille be
ignored."
)
.
SetDefault
(
false
);
AddAttr
<
std
::
vector
<
int
>>
(
"strides"
,
"(vector, default:{1,1,1}), strides(depth, height, "
"width) of pooling operator."
)
.
SetDefault
({
1
,
1
,
1
});
// TODO(Chengduo): Add checker. (Currently,
// TypedAttrChecker don't support vector type.)
AddAttr
<
std
::
vector
<
int
>>
(
"paddings"
,
"(vector defalut:{0,0,0}), paddings(depth, height, "
"width) of pooling operator."
)
AddAttr
<
std
::
vector
<
int
>>
(
"paddings"
,
"(vector defalut:{0,0,0}), paddings(depth, height, "
"width) of pooling operator."
"If globalPooling = true, ksize and paddings wille be ignored."
)
.
SetDefault
({
0
,
0
,
0
});
// TODO(Chengduo): Add checker. (Currently,
// TypedAttrChecker don't support vector type.)
...
...
paddle/operators/pool_op.h
浏览文件 @
8efd0876
...
...
@@ -63,6 +63,7 @@ class PoolKernel : public framework::OpKernel<T> {
std
::
vector
<
int
>
paddings
=
context
.
Attr
<
std
::
vector
<
int
>>
(
"paddings"
);
if
(
context
.
Attr
<
bool
>
(
"globalPooling"
))
{
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
paddings
[
i
]
=
0
;
ksize
[
i
]
=
static_cast
<
int
>
(
in_x
->
dims
()[
i
+
2
]);
}
}
...
...
@@ -103,6 +104,7 @@ class PoolKernel : public framework::OpKernel<T> {
paddings
,
pool_process
);
}
}
break
;
default:
{
PADDLE_THROW
(
"Pool op only supports 2D and 3D input."
);
}
}
}
};
...
...
@@ -123,8 +125,10 @@ class PoolGradKernel : public framework::OpKernel<T> {
std
::
vector
<
int
>
paddings
=
context
.
Attr
<
std
::
vector
<
int
>>
(
"paddings"
);
if
(
context
.
Attr
<
bool
>
(
"globalPooling"
))
{
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
paddings
[
i
]
=
0
;
ksize
[
i
]
=
static_cast
<
int
>
(
in_x
->
dims
()[
i
+
2
]);
}
}
if
(
in_x_grad
)
{
...
...
@@ -164,6 +168,7 @@ class PoolGradKernel : public framework::OpKernel<T> {
*
out_grad
,
ksize
,
strides
,
paddings
,
pool_process
);
}
}
break
;
default:
{
PADDLE_THROW
(
"Pool op only supports 2D and 3D input."
);
}
}
}
}
...
...
paddle/operators/pool_with_index_op.cc
浏览文件 @
8efd0876
...
...
@@ -46,8 +46,10 @@ class MaxPoolWithIndexOp : public framework::OperatorWithKernel {
if
(
ctx
->
Attrs
().
Get
<
bool
>
(
"globalPooling"
))
{
ksize
.
resize
(
static_cast
<
size_t
>
(
in_x_dims
.
size
())
-
2
);
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
paddings
[
i
]
=
0
;
ksize
[
i
]
=
static_cast
<
int
>
(
in_x_dims
[
i
+
2
]);
}
}
PADDLE_ENFORCE
(
in_x_dims
.
size
()
-
ksize
.
size
()
==
2U
,
...
...
@@ -87,31 +89,33 @@ class MaxPool2dWithIndexOpMaker : public framework::OpProtoAndCheckerMaker {
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
AddInput
(
"X"
,
"(Tensor)
T
he input tensor of pooling operator. "
"(Tensor)
, t
he input tensor of pooling operator. "
"The format of input tensor is NCHW. Where N is batch size, C is the "
"number of channels, H and W is the height and width of image."
);
AddOutput
(
"Out"
,
"(Tensor)
T
he output tensor of pooling operator."
"(Tensor)
, t
he output tensor of pooling operator."
"The format of output tensor is also NCHW."
"Where N is batch size, C is "
"the number of channels, H and W is the height and "
"width of image."
);
AddOutput
(
"Mask"
,
"(Tensor)
T
he Mask tensor of pooling operator."
"(Tensor)
, t
he Mask tensor of pooling operator."
"The format of output tensor is also NCHW."
"Where N is batch size, C is the number of channels, H and W "
"is the height and width of image."
"The value in it is the index in current feature map"
);
AddAttr
<
std
::
vector
<
int
>>
(
"ksize"
,
"(vector ), the pooling window size(height, width) of pooling operator."
"If globalPooling = true, ksize is ignored and need not be "
"specified."
);
// TODO(Chengduo): Add checker. (Currently,
AddAttr
<
std
::
vector
<
int
>>
(
"ksize"
,
"(vector ), the pooling window size(height, "
"width) of pooling operator."
"If globalPooling = true, ksize and paddings "
"will be ignored."
);
// TODO(Chengduo): Add
// checker. (Currently,
// TypedAttrChecker don't support vector type.)
AddAttr
<
bool
>
(
"globalPooling"
,
"(bool default: false), whether to use the global pooling."
"If globalPooling = true, ksize is ignored."
)
AddAttr
<
bool
>
(
"globalPooling"
,
"(bool default: false), whether to use the global pooling."
"If globalPooling = true, ksize and paddings will be ignored."
)
.
SetDefault
(
false
);
AddAttr
<
std
::
vector
<
int
>>
(
"strides"
,
...
...
@@ -120,7 +124,8 @@ class MaxPool2dWithIndexOpMaker : public framework::OpProtoAndCheckerMaker {
// TypedAttrChecker don't support vector type.)
AddAttr
<
std
::
vector
<
int
>>
(
"paddings"
,
"(vector defalut:{0,0}), paddings(height, width) of pooling operator."
)
"(vector defalut:{0, 0}), paddings(height, width) of pooling operator."
"If globalPooling = true, paddings and will be ignored."
)
.
SetDefault
({
0
,
0
});
// TODO(Chengduo): Add checker. (Currently,
// TypedAttrChecker don't support vector type.)
...
...
@@ -153,42 +158,46 @@ class MaxPool3dWithIndexOpMaker : public framework::OpProtoAndCheckerMaker {
:
OpProtoAndCheckerMaker
(
proto
,
op_checker
)
{
AddInput
(
"X"
,
"(Tensor)
T
he input tensor of pooling operator. "
"(Tensor)
, t
he input tensor of pooling operator. "
"The format of input tensor is NCDHW. Where N is batch size, C is "
"the number of channels, D, H and W is the depth, height and width of "
"image."
);
AddOutput
(
"Out"
,
"(Tensor)
T
he output tensor of pooling operator."
"(Tensor)
, t
he output tensor of pooling operator."
"The format of output tensor is also NCDHW."
"Where N is batch size, C is "
"the number of channels, D, H and W is the depth, height and "
"width of image."
);
AddOutput
(
"Mask"
,
"(Tensor)
T
he Mask tensor of pooling operator."
"(Tensor)
, t
he Mask tensor of pooling operator."
"The format of output tensor is also NCDHW."
"Where N is batch size, C is the number of channels, D, H and W "
"is the depth, height and width of image."
"The value in it is the index in current feature map"
);
AddAttr
<
std
::
vector
<
int
>>
(
"ksize"
,
"(vector ), the pooling window size(depth, height, width) of pooling "
"operator."
"If globalPooling = true, ksize is ignored and need not be "
"specified."
);
// TODO(Chengduo): Add checker. (Currently,
AddAttr
<
std
::
vector
<
int
>>
(
"ksize"
,
"(vector), the pooling window size(depth, "
"height, width) of pooling "
"operator."
"If globalPooling = true, ksize and paddings "
"will be ignored."
);
// TODO(Chengduo): Add
// checker. (Currently,
// TypedAttrChecker don't support vector type.)
AddAttr
<
bool
>
(
"globalPooling"
,
"(bool default: false), whether to use the global pooling."
"If globalPooling = true, ksize is ignored."
)
AddAttr
<
bool
>
(
"globalPooling"
,
"(bool default: false), whether to use the global pooling."
"If globalPooling = true, ksize and paddings will be ignored."
)
.
SetDefault
(
false
);
AddAttr
<
std
::
vector
<
int
>>
(
"strides"
,
"(vector, default:{1,1,1}), strides(depth, "
"height, width) of pooling operator."
)
.
SetDefault
({
1
,
1
,
1
});
// TODO(Chengduo): Add checker. (Currently,
// TypedAttrChecker don't support vector type.)
AddAttr
<
std
::
vector
<
int
>>
(
"paddings"
,
"(vector defalut:{0,0,0}), paddings(depth, "
"height, width) of pooling operator."
)
AddAttr
<
std
::
vector
<
int
>>
(
"paddings"
,
"(vector defalut:{0,0,0}), paddings(depth, "
"height, width) of pooling operator."
"If globalPooling = true, paddings and ksize will be ignored."
)
.
SetDefault
({
0
,
0
,
0
});
// TODO(Chengduo): Add checker. (Currently,
// TypedAttrChecker don't support vector type.)
...
...
paddle/operators/pool_with_index_op.h
浏览文件 @
8efd0876
...
...
@@ -37,6 +37,7 @@ class MaxPoolWithIndexKernel : public framework::OpKernel<T> {
std
::
vector
<
int
>
paddings
=
context
.
Attr
<
std
::
vector
<
int
>>
(
"paddings"
);
if
(
context
.
Attr
<
bool
>
(
"globalPooling"
))
{
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
paddings
[
i
]
=
0
;
ksize
[
i
]
=
static_cast
<
int
>
(
in_x
->
dims
()[
i
+
2
]);
}
}
...
...
@@ -54,6 +55,7 @@ class MaxPoolWithIndexKernel : public framework::OpKernel<T> {
pool3d_forward
(
context
.
device_context
(),
*
in_x
,
*
out
,
*
mask
,
ksize
,
strides
,
paddings
);
}
break
;
default:
{
PADDLE_THROW
(
"Pool op only supports 2D and 3D input."
);
}
}
}
};
...
...
@@ -72,6 +74,7 @@ class MaxPoolWithIndexGradKernel : public framework::OpKernel<T> {
std
::
vector
<
int
>
paddings
=
context
.
Attr
<
std
::
vector
<
int
>>
(
"paddings"
);
if
(
context
.
Attr
<
bool
>
(
"globalPooling"
))
{
for
(
size_t
i
=
0
;
i
<
ksize
.
size
();
++
i
)
{
paddings
[
i
]
=
0
;
ksize
[
i
]
=
static_cast
<
int
>
(
in_x_grad
->
dims
()[
i
+
2
]);
}
}
...
...
@@ -95,6 +98,7 @@ class MaxPoolWithIndexGradKernel : public framework::OpKernel<T> {
pool3d_backward
(
context
.
device_context
(),
*
in_x_grad
,
*
out_grad
,
*
mask
,
ksize
,
strides
,
paddings
);
}
break
;
default:
{
PADDLE_THROW
(
"Pool op only supports 2D and 3D input."
);
}
}
}
}
...
...
python/paddle/v2/framework/tests/test_pool2d_op.py
浏览文件 @
8efd0876
...
...
@@ -49,9 +49,12 @@ class TestPool2d_Op(OpTest):
self
.
init_test_case
()
self
.
init_op_type
()
self
.
init_pool_type
()
if
self
.
global_pool
:
self
.
paddings
=
[
0
for
_
in
range
(
len
(
self
.
paddings
))]
input
=
np
.
random
.
random
(
self
.
shape
).
astype
(
"float32"
)
output
=
self
.
pool2D_forward_naive
(
input
,
self
.
ksize
,
self
.
strides
,
self
.
paddings
,
self
.
global_pool
)
self
.
paddings
,
self
.
global_pool
).
astype
(
"float32"
)
self
.
inputs
=
{
'X'
:
input
}
self
.
attrs
=
{
...
...
python/paddle/v2/framework/tests/test_pool3d_op.py
浏览文件 @
8efd0876
...
...
@@ -54,10 +54,13 @@ def avg_pool3D_forward_naive(x, ksize, strides, paddings=[0, 0], global_pool=0):
class
TestPool3d_Op
(
OpTest
):
def
setUp
(
self
):
self
.
initTestCase
()
self
.
init_test_case
()
if
self
.
global_pool
:
self
.
paddings
=
[
0
for
_
in
range
(
len
(
self
.
paddings
))]
input
=
np
.
random
.
random
(
self
.
shape
).
astype
(
"float32"
)
output
=
self
.
pool3D_forward_naive
(
input
,
self
.
ksize
,
self
.
strides
,
self
.
paddings
,
self
.
global_pool
)
self
.
paddings
,
self
.
global_pool
).
astype
(
"float32"
)
self
.
inputs
=
{
'X'
:
input
}
self
.
attrs
=
{
...
...
@@ -77,7 +80,7 @@ class TestPool3d_Op(OpTest):
if
self
.
pool_type
!=
"max"
:
self
.
check_grad
(
set
([
'X'
]),
'Out'
,
max_relative_error
=
0.07
)
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
True
self
.
op_type
=
"pool3d"
self
.
pool_type
=
"avg"
...
...
@@ -89,7 +92,7 @@ class TestPool3d_Op(OpTest):
class
TestCase1
(
TestPool3d_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
False
self
.
op_type
=
"pool3d"
self
.
pool_type
=
"avg"
...
...
@@ -101,7 +104,7 @@ class TestCase1(TestPool3d_Op):
class
TestCase2
(
TestPool3d_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
False
self
.
op_type
=
"pool3d"
self
.
pool_type
=
"avg"
...
...
@@ -113,7 +116,7 @@ class TestCase2(TestPool3d_Op):
class
TestCase3
(
TestPool3d_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
True
self
.
op_type
=
"pool3d"
self
.
pool_type
=
"max"
...
...
@@ -125,7 +128,7 @@ class TestCase3(TestPool3d_Op):
class
TestCase4
(
TestPool3d_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
False
self
.
op_type
=
"pool3d"
self
.
pool_type
=
"max"
...
...
@@ -137,7 +140,7 @@ class TestCase4(TestPool3d_Op):
class
TestCase5
(
TestPool3d_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
False
self
.
op_type
=
"pool3d"
self
.
pool_type
=
"max"
...
...
python/paddle/v2/framework/tests/test_pool_max_op.py
浏览文件 @
8efd0876
...
...
@@ -3,11 +3,7 @@ import numpy as np
from
op_test
import
OpTest
def
max_pool3D_forward_naive
(
x
,
ksize
,
strides
,
paddings
=
[
0
,
0
,
0
],
global_pool
=
0
):
def
max_pool3D_forward_naive
(
x
,
ksize
,
strides
,
paddings
,
global_pool
=
0
):
N
,
C
,
D
,
H
,
W
=
x
.
shape
if
global_pool
==
1
:
...
...
@@ -44,7 +40,7 @@ def max_pool3D_forward_naive(x,
return
out
,
mask
def
max_pool2D_forward_naive
(
x
,
ksize
,
strides
,
paddings
=
[
0
,
0
]
,
global_pool
=
0
):
def
max_pool2D_forward_naive
(
x
,
ksize
,
strides
,
paddings
,
global_pool
=
0
):
N
,
C
,
H
,
W
=
x
.
shape
if
global_pool
==
1
:
...
...
@@ -77,10 +73,14 @@ def max_pool2D_forward_naive(x, ksize, strides, paddings=[0, 0], global_pool=0):
class
TestMaxPoolWithIndex_Op
(
OpTest
):
def
setUp
(
self
):
self
.
initTestCase
()
self
.
init_test_case
()
if
self
.
global_pool
:
self
.
paddings
=
[
0
for
_
in
range
(
len
(
self
.
paddings
))]
input
=
np
.
random
.
random
(
self
.
shape
).
astype
(
"float32"
)
output
,
mask
=
self
.
pool_forward_naive
(
input
,
self
.
ksize
,
self
.
strides
,
self
.
paddings
,
self
.
global_pool
)
output
=
output
.
astype
(
"float32"
)
mask
=
mask
.
astype
(
"float32"
)
self
.
attrs
=
{
'strides'
:
self
.
strides
,
...
...
@@ -98,7 +98,7 @@ class TestMaxPoolWithIndex_Op(OpTest):
# def test_check_grad(self):
# self.check_grad(set(['X']), ['Out'], max_relative_error=0.07)
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
True
self
.
index
=
"max_pool3d_with_index"
self
.
op_type
=
"%s"
%
self
.
index
...
...
@@ -110,7 +110,7 @@ class TestMaxPoolWithIndex_Op(OpTest):
class
TestCase1
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
True
self
.
op_type
=
"max_pool3d_with_index"
self
.
pool_forward_naive
=
max_pool3D_forward_naive
...
...
@@ -121,7 +121,7 @@ class TestCase1(TestMaxPoolWithIndex_Op):
class
TestCase2
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
False
self
.
op_type
=
"max_pool3d_with_index"
self
.
pool_forward_naive
=
max_pool3D_forward_naive
...
...
@@ -132,7 +132,7 @@ class TestCase2(TestMaxPoolWithIndex_Op):
class
TestCase3
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
False
self
.
op_type
=
"max_pool3d_with_index"
self
.
pool_forward_naive
=
max_pool3D_forward_naive
...
...
@@ -143,7 +143,7 @@ class TestCase3(TestMaxPoolWithIndex_Op):
class
TestCase4
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
True
self
.
op_type
=
"max_pool3d_with_index"
self
.
pool_forward_naive
=
max_pool3D_forward_naive
...
...
@@ -154,7 +154,7 @@ class TestCase4(TestMaxPoolWithIndex_Op):
class
TestCase5
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
True
self
.
op_type
=
"max_pool3d_with_index"
self
.
pool_forward_naive
=
max_pool3D_forward_naive
...
...
@@ -165,7 +165,7 @@ class TestCase5(TestMaxPoolWithIndex_Op):
class
TestCase6
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
False
self
.
op_type
=
"max_pool2d_with_index"
self
.
pool_forward_naive
=
max_pool2D_forward_naive
...
...
@@ -176,7 +176,7 @@ class TestCase6(TestMaxPoolWithIndex_Op):
class
TestCase7
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
False
self
.
op_type
=
"max_pool2d_with_index"
self
.
pool_forward_naive
=
max_pool2D_forward_naive
...
...
@@ -187,7 +187,7 @@ class TestCase7(TestMaxPoolWithIndex_Op):
class
TestCase8
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
True
self
.
op_type
=
"max_pool2d_with_index"
self
.
pool_forward_naive
=
max_pool2D_forward_naive
...
...
@@ -198,7 +198,7 @@ class TestCase8(TestMaxPoolWithIndex_Op):
class
TestCase9
(
TestMaxPoolWithIndex_Op
):
def
init
TestC
ase
(
self
):
def
init
_test_c
ase
(
self
):
self
.
global_pool
=
True
self
.
op_type
=
"max_pool2d_with_index"
self
.
pool_forward_naive
=
max_pool2D_forward_naive
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录