Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
a7827593
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看板
提交
a7827593
编写于
4月 11, 2017
作者:
L
Luo Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix PadOp bug on Gpu
上级
d324ed7f
变更
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
浏览文件 @
a7827593
...
...
@@ -38,7 +38,7 @@ public:
if
(
err
)
{
*
err
=
Error
(
e
.
what
());
}
else
{
LOG
(
FATAL
)
<<
"Cannot get key "
<<
key
<<
"with error "
<<
e
.
what
();
LOG
(
FATAL
)
<<
"Cannot get key "
<<
key
<<
"
with error "
<<
e
.
what
();
}
return
T
();
}
...
...
paddle/function/PadOpGpu.cu
浏览文件 @
a7827593
...
...
@@ -44,9 +44,9 @@ void Pad<DEVICE_TYPE_GPU>(real* outputs,
size_t
nth
=
num
*
inC
*
inH
*
inW
;
int
blockSize
=
1024
;
int
gridSize
=
(
nth
+
1024
-
1
)
/
1024
;
int
cstart
=
pad
.
channel
Start
,
cend
=
pad
.
channelEnd
;
int
hstart
=
pad
.
height
Start
,
hend
=
pad
.
heightEnd
;
int
wstart
=
pad
.
width
Start
,
wend
=
pad
.
widthEnd
;
int
cstart
=
pad
.
channel
[
0
],
cend
=
pad
.
channel
[
1
]
;
int
hstart
=
pad
.
height
[
0
],
hend
=
pad
.
height
[
1
]
;
int
wstart
=
pad
.
width
[
0
],
wend
=
pad
.
width
[
1
]
;
int
outC
=
inC
+
cstart
+
cend
;
int
outH
=
inH
+
hstart
+
hend
;
int
outW
=
inW
+
wstart
+
wend
;
...
...
@@ -83,9 +83,9 @@ void PadGrad<DEVICE_TYPE_GPU>(real* inGrad,
int
nth
=
num
*
inC
*
inH
*
inW
;
int
blockSize
=
1024
;
int
gridSize
=
(
nth
+
1024
-
1
)
/
1024
;
int
cstart
=
pad
.
channel
Start
,
cend
=
pad
.
channelEnd
;
int
hstart
=
pad
.
height
Start
,
hend
=
pad
.
heightEnd
;
int
wstart
=
pad
.
width
Start
,
wend
=
pad
.
widthEnd
;
int
cstart
=
pad
.
channel
[
0
],
cend
=
pad
.
channel
[
1
]
;
int
hstart
=
pad
.
height
[
0
],
hend
=
pad
.
height
[
1
]
;
int
wstart
=
pad
.
width
[
0
],
wend
=
pad
.
width
[
1
]
;
int
outC
=
inC
+
cstart
+
cend
;
int
outH
=
inH
+
hstart
+
hend
;
int
outW
=
inW
+
wstart
+
wend
;
...
...
paddle/function/PadOpTest.cpp
浏览文件 @
a7827593
...
...
@@ -24,48 +24,22 @@ TEST(Pad, real) {
for
(
size_t
imgSizeW
:
{
5
,
32
,
96
})
{
VLOG
(
3
)
<<
" numSamples="
<<
numSamples
<<
" channels="
<<
channels
<<
" imgSizeH="
<<
imgSizeH
<<
" imgSizeW="
<<
imgSizeW
;
FunctionCompare
compare
(
"Pad"
,
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
,
inDims
));
compare
.
addOutputs
(
BufferArg
(
VALUE_TYPE_FLOAT
,
outDims
,
ASSIGN_TO
));
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
();
for
(
bool
test_grad
:
{
false
,
true
})
{
FunctionCompare
compare
(
test_grad
?
"PadGrad"
:
"Pad"
,
FuncConfig
()
.
set
<
std
::
vector
<
uint32_t
>>
(
"channel"
,
{
2
,
3
})
.
set
<
std
::
vector
<
uint32_t
>>
(
"height"
,
{
1
,
2
})
.
set
<
std
::
vector
<
uint32_t
>>
(
"width"
,
{
3
,
2
}));
TensorShape
inDims
{
numSamples
,
channels
,
imgSizeH
,
imgSizeW
};
TensorShape
outDims
{
numSamples
,
channels
+
5
,
imgSizeH
+
3
,
imgSizeW
+
5
};
compare
.
addInputs
(
BufferArg
(
VALUE_TYPE_FLOAT
,
test_grad
?
outDims
:
inDims
));
compare
.
addOutputs
(
BufferArg
(
VALUE_TYPE_FLOAT
,
test_grad
?
inDims
:
outDims
,
ASSIGN_TO
));
compare
.
run
();
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录