Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
f6e69d74
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f6e69d74
编写于
9月 25, 2017
作者:
C
chengduoZH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix maxpool backward functor
上级
905a462d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
28 deletion
+31
-28
paddle/operators/math/pool_test_maxPool2d.cc
paddle/operators/math/pool_test_maxPool2d.cc
+13
-9
paddle/operators/math/pool_test_maxPool3d.cc
paddle/operators/math/pool_test_maxPool3d.cc
+12
-9
paddle/operators/math/pooling.cc
paddle/operators/math/pooling.cc
+2
-2
paddle/operators/pool_op.h
paddle/operators/pool_op.h
+4
-8
未找到文件。
paddle/operators/math/pool_test_maxPool2d.cc
浏览文件 @
f6e69d74
...
...
@@ -23,16 +23,17 @@
#ifndef PADDLE_ONLY_CPU
template
<
typename
PooType
>
void
testPool2d
(
paddle
::
platform
::
DeviceContext
&
context
,
PooType
pool_process
,
paddle
::
framework
::
Tensor
&
input
,
template
<
typename
Poo
lType
,
typename
PoolGrad
Type
>
void
testPool2d
(
paddle
::
platform
::
DeviceContext
&
context
,
Poo
l
Type
pool_process
,
PoolGradType
poolGrad_process
,
paddle
::
framework
::
Tensor
&
input
,
paddle
::
framework
::
Tensor
&
input_grad
,
paddle
::
framework
::
Tensor
&
output
,
paddle
::
framework
::
Tensor
&
output_grad
,
std
::
vector
<
int
>&
ksize
,
std
::
vector
<
int
>&
strides
,
std
::
vector
<
int
>&
paddings
)
{
paddle
::
operators
::
math
::
Pool2dForwardFunctor
<
paddle
::
platform
::
GPUPlace
,
PooType
,
float
>
Poo
l
Type
,
float
>
pool2d_forward
;
pool2d_forward
(
context
,
input
,
output
,
ksize
,
strides
,
paddings
,
pool_process
);
...
...
@@ -44,10 +45,11 @@ void testPool2d(paddle::platform::DeviceContext& context, PooType pool_process,
start
=
clock
();
for
(
int
i
=
0
;
i
<
times
;
++
i
)
{
paddle
::
operators
::
math
::
Pool2dBackwardFunctor
<
paddle
::
platform
::
GPUPlace
,
PooType
,
float
>
Poo
lGrad
Type
,
float
>
pool2d_backward
;
pool2d_backward
(
context
,
input
,
input_grad
,
output
,
output_grad
,
ksize
,
strides
,
paddings
,
pool_process
);
strides
,
paddings
,
poolGrad_process
);
PADDLE_ENFORCE
(
cudaStreamSynchronize
(
0
),
"cudaStreamSynchronize failed in pool2d_backward CopyFrom"
);
}
...
...
@@ -136,10 +138,12 @@ void test2dPool() {
paddle
::
platform
::
DeviceContext
*
context
=
new
paddle
::
platform
::
CUDADeviceContext
(
paddle
::
platform
::
GPUPlace
());
paddle
::
operators
::
math
::
pool
::
maxPool
<
float
>
pool_process
;
paddle
::
operators
::
math
::
pool
::
maxPoolGrad
<
float
>
poolGrad_process
;
testPool2d
<
paddle
::
operators
::
math
::
pool
::
maxPool
<
float
>>
(
*
context
,
pool_process
,
input
,
input_grad
,
output
,
output_grad
,
ksize
,
strides
,
paddings
);
testPool2d
<
paddle
::
operators
::
math
::
pool
::
maxPool
<
float
>
,
paddle
::
operators
::
math
::
pool
::
maxPoolGrad
<
float
>>
(
*
context
,
pool_process
,
poolGrad_process
,
input
,
input_grad
,
output
,
output_grad
,
ksize
,
strides
,
paddings
);
}
int
main
()
{
...
...
paddle/operators/math/pool_test_maxPool3d.cc
浏览文件 @
f6e69d74
...
...
@@ -23,15 +23,15 @@
#ifndef PADDLE_ONLY_CPU
template
<
typename
PooType
>
void
testPool3d
(
paddle
::
platform
::
DeviceContext
&
context
,
PooType
pool_process
,
paddle
::
framework
::
Tensor
&
input
,
template
<
typename
Poo
lType
,
typename
PoolGrad
Type
>
void
testPool3d
(
paddle
::
platform
::
DeviceContext
&
context
,
Poo
l
Type
pool_process
,
PoolGradType
poolGrad_process
,
paddle
::
framework
::
Tensor
&
input
,
paddle
::
framework
::
Tensor
&
input_grad
,
paddle
::
framework
::
Tensor
&
output
,
paddle
::
framework
::
Tensor
&
output_grad
,
std
::
vector
<
int
>&
ksize
,
std
::
vector
<
int
>&
strides
,
std
::
vector
<
int
>&
paddings
)
{
paddle
::
operators
::
math
::
Pool3dForwardFunctor
<
paddle
::
platform
::
GPUPlace
,
PooType
,
float
>
Poo
l
Type
,
float
>
pool3d_forward
;
pool3d_forward
(
context
,
input
,
output
,
ksize
,
strides
,
paddings
,
pool_process
);
...
...
@@ -44,10 +44,10 @@ void testPool3d(paddle::platform::DeviceContext& context, PooType pool_process,
start
=
clock
();
for
(
int
i
=
0
;
i
<
times
;
++
i
)
{
paddle
::
operators
::
math
::
Pool3dBackwardFunctor
<
paddle
::
platform
::
GPUPlace
,
PooType
,
float
>
Poo
lGrad
Type
,
float
>
pool3d_backward
;
pool3d_backward
(
context
,
input
,
input_grad
,
output
,
output_grad
,
ksize
,
strides
,
paddings
,
pool_process
);
strides
,
paddings
,
pool
Grad
_process
);
PADDLE_ENFORCE
(
cudaStreamSynchronize
(
0
),
"cudaStreamSynchronize failed in pool3d_backward CopyFrom"
);
}
...
...
@@ -145,9 +145,12 @@ void test3dPool() {
new
paddle
::
platform
::
CUDADeviceContext
(
paddle
::
platform
::
GPUPlace
());
paddle
::
operators
::
math
::
pool
::
maxPool
<
float
>
pool_process
;
testPool3d
<
paddle
::
operators
::
math
::
pool
::
maxPool
<
float
>>
(
*
context
,
pool_process
,
input
,
input_grad
,
output
,
output_grad
,
ksize
,
strides
,
paddings
);
paddle
::
operators
::
math
::
pool
::
maxPoolGrad
<
float
>
poolGrad_process
;
testPool3d
<
paddle
::
operators
::
math
::
pool
::
maxPool
<
float
>
,
paddle
::
operators
::
math
::
pool
::
maxPoolGrad
<
float
>>
(
*
context
,
pool_process
,
poolGrad_process
,
input
,
input_grad
,
output
,
output_grad
,
ksize
,
strides
,
paddings
);
}
int
main
()
{
test3dPool
();
}
...
...
paddle/operators/math/pooling.cc
浏览文件 @
f6e69d74
...
...
@@ -196,7 +196,7 @@ class MaxPool2dBackwardFunctor<platform::CPUPlace, T> {
};
template
class
MaxPool2dBackwardFunctor
<
platform
::
CPUPlace
,
float
>;
template
class
MaxPool2dBackwardFunctor
<
platform
::
CPUPlace
,
double
>;
//
template class MaxPool2dBackwardFunctor<platform::CPUPlace, double>;
template
class
Pool2dForwardFunctor
<
platform
::
CPUPlace
,
paddle
::
operators
::
math
::
pool
::
maxPool
<
float
>,
float
>
;
...
...
@@ -443,7 +443,7 @@ class MaxPool3dBackwardFunctor<platform::CPUPlace, T> {
};
template
class
MaxPool3dBackwardFunctor
<
platform
::
CPUPlace
,
float
>;
template
class
MaxPool3dBackwardFunctor
<
platform
::
CPUPlace
,
double
>;
//
template class MaxPool3dBackwardFunctor<platform::CPUPlace, double>;
template
class
Pool3dForwardFunctor
<
platform
::
CPUPlace
,
paddle
::
operators
::
math
::
pool
::
maxPool
<
float
>,
float
>
;
...
...
paddle/operators/pool_op.h
浏览文件 @
f6e69d74
...
...
@@ -111,12 +111,10 @@ class PoolGradKernel : public framework::OpKernel {
switch
(
ksize
.
size
())
{
case
2
:
{
if
(
pooling_type
==
"max"
)
{
paddle
::
operators
::
math
::
Pool2dBackwardFunctor
<
Place
,
paddle
::
operators
::
math
::
pool
::
maxPoolGrad
<
T
>
,
T
>
paddle
::
operators
::
math
::
MaxPool2dBackwardFunctor
<
Place
,
T
>
pool2d_backward
;
paddle
::
operators
::
math
::
pool
::
maxPoolGrad
<
T
>
pool_process
;
pool2d_backward
(
context
.
device_context
(),
*
in_X
,
*
in_X_grad
,
*
out
,
*
out_grad
,
ksize
,
strides
,
paddings
,
pool_process
);
*
out_grad
,
ksize
,
strides
,
paddings
);
}
else
if
(
pooling_type
==
"avg"
)
{
paddle
::
operators
::
math
::
Pool2dBackwardFunctor
<
Place
,
paddle
::
operators
::
math
::
pool
::
avgPoolGrad
<
T
>
,
T
>
...
...
@@ -128,12 +126,10 @@ class PoolGradKernel : public framework::OpKernel {
}
break
;
case
3
:
{
if
(
pooling_type
==
"max"
)
{
paddle
::
operators
::
math
::
Pool3dBackwardFunctor
<
Place
,
paddle
::
operators
::
math
::
pool
::
maxPoolGrad
<
T
>
,
T
>
paddle
::
operators
::
math
::
MaxPool3dBackwardFunctor
<
Place
,
T
>
pool3d_backward
;
paddle
::
operators
::
math
::
pool
::
maxPoolGrad
<
T
>
pool_process
;
pool3d_backward
(
context
.
device_context
(),
*
in_X
,
*
in_X_grad
,
*
out
,
*
out_grad
,
ksize
,
strides
,
paddings
,
pool_process
);
*
out_grad
,
ksize
,
strides
,
paddings
);
}
else
if
(
pooling_type
==
"avg"
)
{
paddle
::
operators
::
math
::
Pool3dBackwardFunctor
<
Place
,
paddle
::
operators
::
math
::
pool
::
avgPoolGrad
<
T
>
,
T
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录