Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e68b50ad
P
Paddle
项目概览
Crayon鑫
/
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看板
提交
e68b50ad
编写于
11月 01, 2016
作者:
W
wangyang59
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed a bug in refactoring ExpandConv/TransLayer
上级
2575b74f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
13 addition
and
5 deletion
+13
-5
paddle/gserver/layers/ConvBaseLayerCpu.cpp
paddle/gserver/layers/ConvBaseLayerCpu.cpp
+13
-5
未找到文件。
paddle/gserver/layers/ConvBaseLayerCpu.cpp
浏览文件 @
e68b50ad
...
@@ -22,11 +22,20 @@ bool ConvBaseLayerCpu::init(const LayerMap &layerMap,
...
@@ -22,11 +22,20 @@ bool ConvBaseLayerCpu::init(const LayerMap &layerMap,
/* Initialize the basic convolutional parent class */
/* Initialize the basic convolutional parent class */
ConvBaseLayer
::
init
(
layerMap
,
parameterMap
);
ConvBaseLayer
::
init
(
layerMap
,
parameterMap
);
/* The class fields channels_ and numFilters_ are the same as in the config
* i.e., channels_ is the for the input and numFilters_ is for the output
*
* But in order for the variables in convTrans having the same semantic
* meaning as in conv, we need to swap channels_ and numFilters here for
* convTrans, and in other functions too.
* */
int
channel
;
int
channel
;
int
nf
;
/* Initialize the projection */
/* Initialize the projection */
for
(
auto
&
inputConfig
:
config_
.
inputs
())
{
for
(
auto
&
inputConfig
:
config_
.
inputs
())
{
const
ConvConfig
&
conf
=
inputConfig
.
conv_conf
();
const
ConvConfig
&
conf
=
inputConfig
.
conv_conf
();
subM_
.
push_back
(
numFilters_
/
conf
.
groups
());
nf
=
isConv_
?
numFilters_
:
conf
.
channels
();
subM_
.
push_back
(
nf
/
conf
.
groups
());
subN_
.
push_back
(
conf
.
output_x
()
*
conf
.
output_x
());
subN_
.
push_back
(
conf
.
output_x
()
*
conf
.
output_x
());
channel
=
isConv_
?
conf
.
channels
()
:
numFilters_
;
channel
=
isConv_
?
conf
.
channels
()
:
numFilters_
;
subK_
.
push_back
(
channel
*
conf
.
filter_size
()
*
conf
.
filter_size
()
/
subK_
.
push_back
(
channel
*
conf
.
filter_size
()
*
conf
.
filter_size
()
/
...
@@ -123,20 +132,19 @@ void ConvBaseLayerCpu::expandFwdOnce(MatrixPtr image, MatrixPtr out,
...
@@ -123,20 +132,19 @@ void ConvBaseLayerCpu::expandFwdOnce(MatrixPtr image, MatrixPtr out,
}
}
}
}
void
ConvBaseLayerCpu
::
bpropActs
(
MatrixPtr
image
,
MatrixPtr
out
,
int
inpIdx
)
{
void
ConvBaseLayerCpu
::
bpropActs
(
MatrixPtr
out
,
MatrixPtr
image
,
int
inpIdx
)
{
int
channel
=
isConv_
?
channels_
[
inpIdx
]
:
numFilters_
;
int
channel
=
isConv_
?
channels_
[
inpIdx
]
:
numFilters_
;
int
subM
=
subM_
[
inpIdx
];
int
subM
=
subM_
[
inpIdx
];
int
subN
=
subN_
[
inpIdx
];
int
subN
=
subN_
[
inpIdx
];
int
subK
=
subK_
[
inpIdx
];
int
subK
=
subK_
[
inpIdx
];
size_t
batchSize
=
image
->
getHeight
();
size_t
batchSize
=
image
->
getHeight
();
MatrixPtr
tgtGrad
=
out
;
/* reset the expand-grad memory */
/* reset the expand-grad memory */
resetExpandInput
(
subK
*
groups_
[
inpIdx
],
subN
);
resetExpandInput
(
subK
*
groups_
[
inpIdx
],
subN
);
real
*
localGradData
=
image
->
getData
();
real
*
localGradData
=
out
->
getData
();
real
*
tgtGradData
=
tgtGrad
->
getData
();
real
*
tgtGradData
=
image
->
getData
();
for
(
size_t
n
=
0
;
n
<
batchSize
;
n
++
)
{
for
(
size_t
n
=
0
;
n
<
batchSize
;
n
++
)
{
real
*
wgtData
=
weights_
[
inpIdx
]
->
getW
()
->
getData
();
real
*
wgtData
=
weights_
[
inpIdx
]
->
getW
()
->
getData
();
real
*
expandInData
=
expandInput_
->
getData
();
real
*
expandInData
=
expandInput_
->
getData
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录