Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
048b14a9
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看板
提交
048b14a9
编写于
5月 26, 2017
作者:
H
hedaoyuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change stride to strides, and change padding to paddings.
上级
455888c5
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
29 addition
and
16 deletion
+29
-16
paddle/function/ConvOp.h
paddle/function/ConvOp.h
+11
-4
paddle/function/ConvOpTest.cpp
paddle/function/ConvOpTest.cpp
+4
-2
paddle/function/GemmConvOp.cpp
paddle/function/GemmConvOp.cpp
+4
-4
paddle/function/NaiveConvOp.cpp
paddle/function/NaiveConvOp.cpp
+10
-6
未找到文件。
paddle/function/ConvOp.h
浏览文件 @
048b14a9
...
...
@@ -36,8 +36,8 @@ class ConvFunctionBase : public FunctionBase {
public:
void
init
(
const
FuncConfig
&
config
)
override
{
// function arguments
stride
_
=
config
.
get
<
size_t
>
(
"stride
"
);
padding
_
=
config
.
get
<
size_t
>
(
"padding
"
);
stride
s_
=
config
.
get
<
std
::
vector
<
size_t
>>
(
"strides
"
);
padding
s_
=
config
.
get
<
std
::
vector
<
size_t
>>
(
"paddings
"
);
// number of inputs and outputs
numInputs_
=
2
;
...
...
@@ -60,8 +60,15 @@ public:
}
protected:
size_t
padding_
;
size_t
stride_
;
std
::
vector
<
size_t
>
strides_
;
std
::
vector
<
size_t
>
paddings_
;
inline
int
strideH
()
const
{
return
strides_
[
0
];
}
inline
int
strideW
()
const
{
return
strides_
[
1
];
}
inline
int
paddingH
()
const
{
return
paddings_
[
0
];
}
inline
int
paddingW
()
const
{
return
paddings_
[
1
];
}
};
}
// namespace paddle
paddle/function/ConvOpTest.cpp
浏览文件 @
048b14a9
...
...
@@ -48,11 +48,13 @@ public:
<<
" outputWidth="
<<
outputSize
<<
" stride="
<<
stride
<<
" padding="
<<
padding
;
std
::
vector
<
size_t
>
paddings
=
{
padding
,
padding
};
std
::
vector
<
size_t
>
strides
=
{
stride
,
stride
};
Compare2CpuFunction
test
(
conv1
,
conv2
,
FuncConfig
()
.
set
(
"padding
"
,
padding
)
.
set
(
"stride
"
,
stride
)
.
set
(
"padding
s"
,
paddings
)
.
set
(
"stride
s"
,
strides
)
.
set
(
"algo"
,
algo
));
TensorShape
shape0
{
...
...
paddle/function/GemmConvOp.cpp
浏览文件 @
048b14a9
...
...
@@ -118,10 +118,10 @@ public:
inputWidth
,
filterHeight
,
filterWidth
,
stride
_
,
stride
_
,
padding
_
,
padding
_
,
stride
H
()
,
stride
W
()
,
padding
H
()
,
padding
W
()
,
outputHeight
,
outputWidth
,
colData
);
...
...
paddle/function/NaiveConvOp.cpp
浏览文件 @
048b14a9
...
...
@@ -37,14 +37,16 @@ public:
size_t
outputChannels
,
size_t
outputHeight
,
size_t
outputWidth
,
size_t
padding
,
size_t
stride
)
{
size_t
paddingH
,
size_t
paddingW
,
size_t
strideH
,
size_t
strideW
)
{
for
(
size_t
batch
=
0
;
batch
<
batchSize
;
batch
++
)
{
for
(
size_t
outC
=
0
;
outC
<
outputChannels
;
outC
++
)
{
for
(
size_t
outH
=
0
;
outH
<
outputHeight
;
outH
++
)
{
for
(
size_t
outW
=
0
;
outW
<
outputWidth
;
outW
++
)
{
const
int
inStartH
=
(
outH
*
stride
)
-
padding
;
const
int
inStartW
=
(
outW
*
stride
)
-
padding
;
const
int
inStartH
=
(
outH
*
stride
H
)
-
paddingH
;
const
int
inStartW
=
(
outW
*
stride
W
)
-
paddingW
;
T
outValue
=
(
T
)
0
;
for
(
size_t
inC
=
0
;
inC
<
inputChannels
;
inC
++
)
{
for
(
size_t
fH
=
0
;
fH
<
filterHeight
;
fH
++
)
{
...
...
@@ -118,8 +120,10 @@ public:
outputChannels
,
outputHeight
,
outputWidth
,
padding_
,
stride_
);
paddingH
(),
paddingW
(),
strideH
(),
strideW
());
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录