Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
3133c09f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3133c09f
编写于
4月 11, 2017
作者:
T
Tao Luo
提交者:
GitHub
4月 11, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1768 from luotao1/pad
fix PadOp bug on Gpu
上级
87afc6dc
a7827593
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
49 deletion
+23
-49
paddle/function/Function.h
paddle/function/Function.h
+1
-1
paddle/function/PadOpGpu.cu
paddle/function/PadOpGpu.cu
+6
-6
paddle/function/PadOpTest.cpp
paddle/function/PadOpTest.cpp
+16
-42
未找到文件。
paddle/function/Function.h
浏览文件 @
3133c09f
...
@@ -38,7 +38,7 @@ public:
...
@@ -38,7 +38,7 @@ public:
if
(
err
)
{
if
(
err
)
{
*
err
=
Error
(
e
.
what
());
*
err
=
Error
(
e
.
what
());
}
else
{
}
else
{
LOG
(
FATAL
)
<<
"Cannot get key "
<<
key
<<
"with error "
<<
e
.
what
();
LOG
(
FATAL
)
<<
"Cannot get key "
<<
key
<<
"
with error "
<<
e
.
what
();
}
}
return
T
();
return
T
();
}
}
...
...
paddle/function/PadOpGpu.cu
浏览文件 @
3133c09f
...
@@ -44,9 +44,9 @@ void Pad<DEVICE_TYPE_GPU>(real* outputs,
...
@@ -44,9 +44,9 @@ void Pad<DEVICE_TYPE_GPU>(real* outputs,
size_t
nth
=
num
*
inC
*
inH
*
inW
;
size_t
nth
=
num
*
inC
*
inH
*
inW
;
int
blockSize
=
1024
;
int
blockSize
=
1024
;
int
gridSize
=
(
nth
+
1024
-
1
)
/
1024
;
int
gridSize
=
(
nth
+
1024
-
1
)
/
1024
;
int
cstart
=
pad
.
channel
Start
,
cend
=
pad
.
channelEnd
;
int
cstart
=
pad
.
channel
[
0
],
cend
=
pad
.
channel
[
1
]
;
int
hstart
=
pad
.
height
Start
,
hend
=
pad
.
heightEnd
;
int
hstart
=
pad
.
height
[
0
],
hend
=
pad
.
height
[
1
]
;
int
wstart
=
pad
.
width
Start
,
wend
=
pad
.
widthEnd
;
int
wstart
=
pad
.
width
[
0
],
wend
=
pad
.
width
[
1
]
;
int
outC
=
inC
+
cstart
+
cend
;
int
outC
=
inC
+
cstart
+
cend
;
int
outH
=
inH
+
hstart
+
hend
;
int
outH
=
inH
+
hstart
+
hend
;
int
outW
=
inW
+
wstart
+
wend
;
int
outW
=
inW
+
wstart
+
wend
;
...
@@ -83,9 +83,9 @@ void PadGrad<DEVICE_TYPE_GPU>(real* inGrad,
...
@@ -83,9 +83,9 @@ void PadGrad<DEVICE_TYPE_GPU>(real* inGrad,
int
nth
=
num
*
inC
*
inH
*
inW
;
int
nth
=
num
*
inC
*
inH
*
inW
;
int
blockSize
=
1024
;
int
blockSize
=
1024
;
int
gridSize
=
(
nth
+
1024
-
1
)
/
1024
;
int
gridSize
=
(
nth
+
1024
-
1
)
/
1024
;
int
cstart
=
pad
.
channel
Start
,
cend
=
pad
.
channelEnd
;
int
cstart
=
pad
.
channel
[
0
],
cend
=
pad
.
channel
[
1
]
;
int
hstart
=
pad
.
height
Start
,
hend
=
pad
.
heightEnd
;
int
hstart
=
pad
.
height
[
0
],
hend
=
pad
.
height
[
1
]
;
int
wstart
=
pad
.
width
Start
,
wend
=
pad
.
widthEnd
;
int
wstart
=
pad
.
width
[
0
],
wend
=
pad
.
width
[
1
]
;
int
outC
=
inC
+
cstart
+
cend
;
int
outC
=
inC
+
cstart
+
cend
;
int
outH
=
inH
+
hstart
+
hend
;
int
outH
=
inH
+
hstart
+
hend
;
int
outW
=
inW
+
wstart
+
wend
;
int
outW
=
inW
+
wstart
+
wend
;
...
...
paddle/function/PadOpTest.cpp
浏览文件 @
3133c09f
...
@@ -24,48 +24,22 @@ TEST(Pad, real) {
...
@@ -24,48 +24,22 @@ TEST(Pad, real) {
for
(
size_t
imgSizeW
:
{
5
,
32
,
96
})
{
for
(
size_t
imgSizeW
:
{
5
,
32
,
96
})
{
VLOG
(
3
)
<<
" numSamples="
<<
numSamples
<<
" channels="
<<
channels
VLOG
(
3
)
<<
" numSamples="
<<
numSamples
<<
" channels="
<<
channels
<<
" imgSizeH="
<<
imgSizeH
<<
" imgSizeW="
<<
imgSizeW
;
<<
" imgSizeH="
<<
imgSizeH
<<
" imgSizeW="
<<
imgSizeW
;
for
(
bool
test_grad
:
{
false
,
true
})
{
FunctionCompare
compare
(
"Pad"
,
FunctionCompare
compare
(
FuncConfig
()
test_grad
?
"PadGrad"
:
"Pad"
,
.
set
(
"cstart"
,
2
)
FuncConfig
()
.
set
(
"cend"
,
3
)
.
set
<
std
::
vector
<
uint32_t
>>
(
"channel"
,
{
2
,
3
})
.
set
(
"hstart"
,
1
)
.
set
<
std
::
vector
<
uint32_t
>>
(
"height"
,
{
1
,
2
})
.
set
(
"hend"
,
2
)
.
set
<
std
::
vector
<
uint32_t
>>
(
"width"
,
{
3
,
2
}));
.
set
(
"wstart"
,
3
)
TensorShape
inDims
{
numSamples
,
channels
,
imgSizeH
,
imgSizeW
};
.
set
(
"wend"
,
2
));
TensorShape
outDims
{
TensorShape
inDims
{
numSamples
,
channels
,
imgSizeH
,
imgSizeW
};
numSamples
,
channels
+
5
,
imgSizeH
+
3
,
imgSizeW
+
5
};
TensorShape
outDims
{
compare
.
addInputs
(
numSamples
,
channels
+
5
,
imgSizeH
+
3
,
imgSizeW
+
5
};
BufferArg
(
VALUE_TYPE_FLOAT
,
test_grad
?
outDims
:
inDims
));
compare
.
addInputs
(
BufferArg
(
VALUE_TYPE_FLOAT
,
inDims
));
compare
.
addOutputs
(
BufferArg
(
compare
.
addOutputs
(
BufferArg
(
VALUE_TYPE_FLOAT
,
outDims
,
ASSIGN_TO
));
VALUE_TYPE_FLOAT
,
test_grad
?
inDims
:
outDims
,
ASSIGN_TO
));
compare
.
run
();
compare
.
run
();
}
}
}
}
}
}
TEST
(
PadGrad
,
real
)
{
for
(
size_t
numSamples
:
{
5
,
32
})
{
for
(
size_t
channels
:
{
1
,
5
,
32
})
{
for
(
size_t
imgSizeH
:
{
5
,
33
,
100
})
{
for
(
size_t
imgSizeW
:
{
5
,
32
,
96
})
{
VLOG
(
3
)
<<
" numSamples="
<<
numSamples
<<
" channels="
<<
channels
<<
" imgSizeH="
<<
imgSizeH
<<
" imgSizeW="
<<
imgSizeW
;
FunctionCompare
compare
(
"PadGrad"
,
FuncConfig
()
.
set
(
"cstart"
,
2
)
.
set
(
"cend"
,
3
)
.
set
(
"hstart"
,
1
)
.
set
(
"hend"
,
2
)
.
set
(
"wstart"
,
3
)
.
set
(
"wend"
,
2
));
TensorShape
inDims
{
numSamples
,
channels
,
imgSizeH
,
imgSizeW
};
TensorShape
outDims
{
numSamples
,
channels
+
5
,
imgSizeH
+
3
,
imgSizeW
+
5
};
compare
.
addInputs
(
BufferArg
(
VALUE_TYPE_FLOAT
,
outDims
));
compare
.
addOutputs
(
BufferArg
(
VALUE_TYPE_FLOAT
,
inDims
,
ASSIGN_TO
));
compare
.
run
();
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录