Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
73da9720
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
73da9720
编写于
9月 18, 2017
作者:
L
Luo Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix AvgPoolBackward and using CaffeMode in test_AvgPoolFwdBwd
上级
8067a42b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
11 deletion
+14
-11
paddle/cuda/src/hl_cuda_cnn.cu
paddle/cuda/src/hl_cuda_cnn.cu
+10
-5
paddle/math/tests/test_matrixCompare.cpp
paddle/math/tests/test_matrixCompare.cpp
+4
-6
未找到文件。
paddle/cuda/src/hl_cuda_cnn.cu
浏览文件 @
73da9720
...
@@ -298,11 +298,13 @@ __global__ void KeAvgPoolBackward(const int nthreads,
...
@@ -298,11 +298,13 @@ __global__ void KeAvgPoolBackward(const int nthreads,
for
(
int
ph
=
phstart
;
ph
<
phend
;
++
ph
)
{
for
(
int
ph
=
phstart
;
ph
<
phend
;
++
ph
)
{
int
hstart
=
ph
*
strideH
-
padH
;
int
hstart
=
ph
*
strideH
-
padH
;
int
hend
=
min
(
hstart
+
sizeY
,
height
+
padH
);
int
hend
=
min
(
hstart
+
sizeY
,
height
);
hstart
=
max
(
hstart
,
0
);
for
(
int
pw
=
pwstart
;
pw
<
pwend
;
++
pw
)
{
for
(
int
pw
=
pwstart
;
pw
<
pwend
;
++
pw
)
{
// figure out the pooling size
// figure out the pooling size
int
wstart
=
pw
*
strideW
-
padW
;
int
wstart
=
pw
*
strideW
-
padW
;
int
wend
=
min
(
wstart
+
sizeX
,
width
+
padW
);
int
wend
=
min
(
wstart
+
sizeX
,
width
);
wstart
=
max
(
wstart
,
0
);
int
poolsize
=
(
hend
-
hstart
)
*
(
wend
-
wstart
);
int
poolsize
=
(
hend
-
hstart
)
*
(
wend
-
wstart
);
gradient
+=
outGrad
[
ph
*
pooledW
+
pw
]
/
poolsize
;
gradient
+=
outGrad
[
ph
*
pooledW
+
pw
]
/
poolsize
;
}
}
...
@@ -708,14 +710,17 @@ __global__ void KeAvgPool3DBackward(const int nthreads,
...
@@ -708,14 +710,17 @@ __global__ void KeAvgPool3DBackward(const int nthreads,
for
(
int
pd
=
pdstart
;
pd
<
pdend
;
++
pd
)
{
for
(
int
pd
=
pdstart
;
pd
<
pdend
;
++
pd
)
{
int
dstart
=
pd
*
strideD
-
padD
;
int
dstart
=
pd
*
strideD
-
padD
;
int
dend
=
min
(
dstart
+
sizeZ
,
depth
+
padD
);
int
dend
=
min
(
dstart
+
sizeZ
,
depth
);
dstart
=
max
(
dstart
,
0
);
for
(
int
ph
=
phstart
;
ph
<
phend
;
++
ph
)
{
for
(
int
ph
=
phstart
;
ph
<
phend
;
++
ph
)
{
int
hstart
=
ph
*
strideH
-
padH
;
int
hstart
=
ph
*
strideH
-
padH
;
int
hend
=
min
(
hstart
+
sizeY
,
height
+
padH
);
int
hend
=
min
(
hstart
+
sizeY
,
height
);
hstart
=
max
(
hstart
,
0
);
for
(
int
pw
=
pwstart
;
pw
<
pwend
;
++
pw
)
{
for
(
int
pw
=
pwstart
;
pw
<
pwend
;
++
pw
)
{
// figure out the pooling size
// figure out the pooling size
int
wstart
=
pw
*
strideW
-
padW
;
int
wstart
=
pw
*
strideW
-
padW
;
int
wend
=
min
(
wstart
+
sizeX
,
width
+
padW
);
int
wend
=
min
(
wstart
+
sizeX
,
width
);
wstart
=
max
(
wstart
,
0
);
int
poolsize
=
(
dend
-
dstart
)
*
(
hend
-
hstart
)
*
(
wend
-
wstart
);
int
poolsize
=
(
dend
-
dstart
)
*
(
hend
-
hstart
)
*
(
wend
-
wstart
);
gradient
+=
outGrad
[(
pd
*
pooledH
+
ph
)
*
pooledW
+
pw
]
/
poolsize
;
gradient
+=
outGrad
[(
pd
*
pooledH
+
ph
)
*
pooledW
+
pw
]
/
poolsize
;
}
}
...
...
paddle/math/tests/test_matrixCompare.cpp
浏览文件 @
73da9720
...
@@ -825,9 +825,8 @@ void testMaxPoolFwdBwd(int numSamples,
...
@@ -825,9 +825,8 @@ void testMaxPoolFwdBwd(int numSamples,
int
strideW
,
int
strideW
,
int
padH
,
int
padH
,
int
padW
)
{
int
padW
)
{
int
outH
=
0
,
outW
=
0
;
int
outH
=
outputSize
(
imgSizeH
,
ksizeH
,
padH
,
strideH
,
true
);
outH
=
(
imgSizeH
-
ksizeH
+
2
*
padH
+
strideH
-
1
)
/
strideH
+
1
;
int
outW
=
outputSize
(
imgSizeW
,
ksizeW
,
padW
,
strideW
,
true
);
outW
=
(
imgSizeW
-
ksizeW
+
2
*
padW
+
strideW
-
1
)
/
strideW
+
1
;
int
inWidth
=
imgSizeH
*
imgSizeW
*
channels
;
int
inWidth
=
imgSizeH
*
imgSizeW
*
channels
;
MatrixPtr
input
=
CpuMatrix
::
create
(
numSamples
,
inWidth
,
false
,
false
);
MatrixPtr
input
=
CpuMatrix
::
create
(
numSamples
,
inWidth
,
false
,
false
);
...
@@ -927,9 +926,8 @@ void testAvgPoolFwdBwd(int numSamples,
...
@@ -927,9 +926,8 @@ void testAvgPoolFwdBwd(int numSamples,
int
strideW
,
int
strideW
,
int
padH
,
int
padH
,
int
padW
)
{
int
padW
)
{
int
outH
=
0
,
outW
=
0
;
int
outH
=
outputSize
(
imgSizeH
,
ksizeH
,
padH
,
strideH
,
true
);
outH
=
(
imgSizeH
-
ksizeH
+
2
*
padH
+
strideH
-
1
)
/
strideH
+
1
;
int
outW
=
outputSize
(
imgSizeW
,
ksizeW
,
padW
,
strideW
,
true
);
outW
=
(
imgSizeW
-
ksizeW
+
2
*
padW
+
strideW
-
1
)
/
strideW
+
1
;
int
inWidth
=
imgSizeH
*
imgSizeW
*
channels
;
int
inWidth
=
imgSizeH
*
imgSizeW
*
channels
;
MatrixPtr
input
=
CpuMatrix
::
create
(
numSamples
,
inWidth
,
false
,
false
);
MatrixPtr
input
=
CpuMatrix
::
create
(
numSamples
,
inWidth
,
false
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录