Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
19c989ac
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看板
提交
19c989ac
编写于
11月 16, 2017
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix error and pass unit test
上级
40a486d8
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
19 addition
and
7 deletion
+19
-7
paddle/gserver/layers/MKLDNNConcatLayer.cpp
paddle/gserver/layers/MKLDNNConcatLayer.cpp
+15
-3
paddle/gserver/layers/MKLDNNConcatLayer.h
paddle/gserver/layers/MKLDNNConcatLayer.h
+4
-4
未找到文件。
paddle/gserver/layers/MKLDNNConcatLayer.cpp
浏览文件 @
19c989ac
...
...
@@ -40,7 +40,9 @@ void MKLDNNConcatLayer::reshape(
CHECK_GT
(
inputLayers_
.
size
(),
1UL
);
channels_
.
resize
(
inputLayers_
.
size
());
channels_
[
0
]
=
ic
;
oc
=
ic
;
// need change the output channel, so use oc_ instead
// TODO(TJ): change API, use &oc
oc_
=
ic
;
for
(
size_t
i
=
1
;
i
<
inputLayers_
.
size
();
i
++
)
{
int
batchsize
,
height
,
witdh
;
reshapeInput
(
batchsize
,
height
,
witdh
,
i
);
...
...
@@ -50,12 +52,12 @@ void MKLDNNConcatLayer::reshape(
channels_
[
i
]
=
inputLayers_
[
i
]
->
getSize
()
/
height
/
witdh
;
CHECK_EQ
((
size_t
)
channels_
[
i
]
*
height
*
witdh
,
inputLayers_
[
i
]
->
getSize
());
oc
+=
channels_
[
i
];
oc
_
+=
channels_
[
i
];
}
oh
=
ih
;
ow
=
iw
;
reshapeOutput
(
oh
,
ow
);
resizeOutput
(
bs
,
oc
*
oh
*
ow
);
resizeOutput
(
bs
,
oc
_
*
oh
*
ow
);
}
void
MKLDNNConcatLayer
::
resetFwd
(
std
::
vector
<
primitive
>&
pipeline
,
...
...
@@ -88,6 +90,9 @@ void MKLDNNConcatLayer::resetFwdBuffers(std::vector<MKLDNNMatrixPtr>& inputs,
inputs
.
resize
(
inputLayers_
.
size
());
bool
has8c
=
false
,
has16c
=
false
,
hasnc
=
false
;
for
(
size_t
i
=
0
;
i
<
inputs
.
size
();
i
++
)
{
// resetInValue will use ic_ so temporary change as current input's channel
// TODO(TJ): change ic_ as vector then can remove channels_
ic_
=
channels_
[
i
];
resetInValue
(
inputs
[
i
],
nullptr
,
i
);
CHECK
(
inputs
[
i
]);
auto
dm
=
inputs
[
i
]
->
getDims
();
...
...
@@ -109,6 +114,8 @@ void MKLDNNConcatLayer::resetFwdBuffers(std::vector<MKLDNNMatrixPtr>& inputs,
has16c
=
true
;
}
}
// change back, ic_ always save the input 0 size
ic_
=
channels_
[
0
];
format
outFmt
;
if
(
has16c
&&
oc_
%
16
==
0
)
{
...
...
@@ -161,9 +168,14 @@ void MKLDNNConcatLayer::resetBwdBuffers(std::vector<MKLDNNMatrixPtr>& inputs,
inputs
.
resize
(
inputLayers_
.
size
());
for
(
size_t
i
=
0
;
i
<
inputs
.
size
();
i
++
)
{
CHECK
(
inVals_
[
i
]);
// resetInGrad will use inVal_
// TODO(TJ): change move inVals_ to MKLDNNLayer ans remove inVal_
inVal_
=
inVals_
[
i
];
resetInGrad
(
inputs
[
i
],
inVals_
[
i
]
->
getPrimitiveDesc
(),
i
);
CHECK_PRIMITIVE_DESC_EQ
(
inputs
[
i
],
inVals_
[
i
]
->
getPrimitiveDesc
());
}
// change back, inVal_ always save the input 0
inVal_
=
inVals_
[
0
];
}
void
MKLDNNConcatLayer
::
resetBwdPipeline
(
...
...
paddle/gserver/layers/MKLDNNConcatLayer.h
浏览文件 @
19c989ac
...
...
@@ -74,8 +74,8 @@ public:
void
printValueFormat
()
override
{
for
(
size_t
i
=
0
;
i
<
inVals_
.
size
();
++
i
)
{
VLOG
(
MKLDNN_FMTS
)
<<
"Input "
<<
i
<<
inputLayers_
[
i
]
->
getName
()
<<
": "
<<
inVals_
[
i
]
->
getFormat
()
<<
" >>>"
;
VLOG
(
MKLDNN_FMTS
)
<<
"Input "
<<
i
<<
", "
<<
inputLayers_
[
i
]
->
getName
()
<<
": "
<<
inVals_
[
i
]
->
getFormat
()
<<
" >>>"
;
}
if
(
outVal_
)
{
VLOG
(
MKLDNN_FMTS
)
<<
outVal_
->
getFormat
()
<<
" >>> "
;
...
...
@@ -93,8 +93,8 @@ public:
VLOG
(
MKLDNN_FMTS
)
<<
outGrad_
->
getFormat
()
<<
" <<< "
;
}
for
(
size_t
i
=
0
;
i
<
inGrads_
.
size
();
++
i
)
{
VLOG
(
MKLDNN_FMTS
)
<<
"Input "
<<
i
<<
inputLayers_
[
i
]
->
getName
()
<<
": "
<<
inGrads_
[
i
]
->
getFormat
()
<<
"<<<"
;
VLOG
(
MKLDNN_FMTS
)
<<
"Input "
<<
i
<<
", "
<<
inputLayers_
[
i
]
->
getName
()
<<
": "
<<
inGrads_
[
i
]
->
getFormat
()
<<
"<<<"
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录