Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
3117d977
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看板
提交
3117d977
编写于
11月 20, 2017
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add inputChannel in resetInValue for concat layer
上级
c397599d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
10 deletion
+10
-10
paddle/gserver/layers/MKLDNNConcatLayer.cpp
paddle/gserver/layers/MKLDNNConcatLayer.cpp
+1
-6
paddle/gserver/layers/MKLDNNLayer.cpp
paddle/gserver/layers/MKLDNNLayer.cpp
+5
-3
paddle/gserver/layers/MKLDNNLayer.h
paddle/gserver/layers/MKLDNNLayer.h
+4
-1
未找到文件。
paddle/gserver/layers/MKLDNNConcatLayer.cpp
浏览文件 @
3117d977
...
@@ -84,10 +84,7 @@ void MKLDNNConcatLayer::resetFwdBuffers(std::vector<MKLDNNMatrixPtr>& inputs,
...
@@ -84,10 +84,7 @@ void MKLDNNConcatLayer::resetFwdBuffers(std::vector<MKLDNNMatrixPtr>& inputs,
inputs
.
resize
(
inputLayers_
.
size
());
inputs
.
resize
(
inputLayers_
.
size
());
bool
has8c
=
false
,
has16c
=
false
,
hasnc
=
false
;
bool
has8c
=
false
,
has16c
=
false
,
hasnc
=
false
;
for
(
size_t
i
=
0
;
i
<
inputs
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
inputs
.
size
();
i
++
)
{
// resetInValue will use ic_ so temporary change as current input's channel
resetInValue
(
inputs
[
i
],
nullptr
,
i
,
channels_
[
i
]);
// TODO(TJ): change ic_ as vector then can remove channels_
ic_
=
channels_
[
i
];
resetInValue
(
inputs
[
i
],
nullptr
,
i
);
CHECK
(
inputs
[
i
]);
CHECK
(
inputs
[
i
]);
auto
dm
=
inputs
[
i
]
->
getDims
();
auto
dm
=
inputs
[
i
]
->
getDims
();
// inputs format can be different, but ndims must equal
// inputs format can be different, but ndims must equal
...
@@ -108,8 +105,6 @@ void MKLDNNConcatLayer::resetFwdBuffers(std::vector<MKLDNNMatrixPtr>& inputs,
...
@@ -108,8 +105,6 @@ void MKLDNNConcatLayer::resetFwdBuffers(std::vector<MKLDNNMatrixPtr>& inputs,
has16c
=
true
;
has16c
=
true
;
}
}
}
}
// change back, ic_ always save the input 0 size
ic_
=
channels_
[
0
];
format
outFmt
;
format
outFmt
;
if
(
has16c
&&
oc_
%
16
==
0
)
{
if
(
has16c
&&
oc_
%
16
==
0
)
{
...
...
paddle/gserver/layers/MKLDNNLayer.cpp
浏览文件 @
3117d977
...
@@ -176,13 +176,15 @@ void MKLDNNLayer::resetWithMatrix(MKLDNNMatrixPtr& dnn,
...
@@ -176,13 +176,15 @@ void MKLDNNLayer::resetWithMatrix(MKLDNNMatrixPtr& dnn,
void
MKLDNNLayer
::
resetInValue
(
void
MKLDNNLayer
::
resetInValue
(
MKLDNNMatrixPtr
&
in
,
MKLDNNMatrixPtr
&
in
,
const
std
::
shared_ptr
<
memory
::
primitive_desc
>&
intPD
,
const
std
::
shared_ptr
<
memory
::
primitive_desc
>&
intPD
,
size_t
inputIdx
)
{
size_t
inputIdx
,
int
inputChannel
)
{
cvtInVal_
=
nullptr
;
cvtInVal_
=
nullptr
;
extInVal_
=
nullptr
;
extInVal_
=
nullptr
;
in
=
nullptr
;
in
=
nullptr
;
CHECK_GT
(
bs_
*
ic_
*
ih_
*
iw_
,
0
);
inputChannel
=
inputChannel
==
0
?
ic_
:
inputChannel
;
CHECK_GT
(
bs_
*
inputChannel
*
ih_
*
iw_
,
0
);
auto
extPD
=
MKLDNNMatrix
::
createPrimitiveDesc
(
auto
extPD
=
MKLDNNMatrix
::
createPrimitiveDesc
(
{
bs_
,
i
c_
,
ih_
,
iw_
},
format
::
nchw
,
engine_
);
{
bs_
,
i
nputChannel
,
ih_
,
iw_
},
format
::
nchw
,
engine_
);
const
MatrixPtr
&
inMat
=
inputLayers_
[
inputIdx
]
->
getOutputValue
();
const
MatrixPtr
&
inMat
=
inputLayers_
[
inputIdx
]
->
getOutputValue
();
extInVal_
=
std
::
dynamic_pointer_cast
<
MKLDNNMatrix
>
(
inMat
);
extInVal_
=
std
::
dynamic_pointer_cast
<
MKLDNNMatrix
>
(
inMat
);
CHECK_EQ
(
inputIsOnlyMKLDNN
(),
extInVal_
!=
nullptr
);
CHECK_EQ
(
inputIsOnlyMKLDNN
(),
extInVal_
!=
nullptr
);
...
...
paddle/gserver/layers/MKLDNNLayer.h
浏览文件 @
3117d977
...
@@ -38,6 +38,7 @@ protected:
...
@@ -38,6 +38,7 @@ protected:
size_t
inputElemenCnt_
;
size_t
inputElemenCnt_
;
// batch size
// batch size
int
bs_
;
int
bs_
;
// they sizes are always from the first input layer
// input image channel, height and width
// input image channel, height and width
int
ic_
,
ih_
,
iw_
;
int
ic_
,
ih_
,
iw_
;
// output image channel, height and width
// output image channel, height and width
...
@@ -196,11 +197,13 @@ protected:
...
@@ -196,11 +197,13 @@ protected:
/**
/**
* reset input value from input MKLDNNMatrix and internal primitive desc.
* reset input value from input MKLDNNMatrix and internal primitive desc.
* reset both internal and external buffer and create reorder if necessary.
* reset both internal and external buffer and create reorder if necessary.
* input channel may be different in concat.
*/
*/
void
resetInValue
(
void
resetInValue
(
MKLDNNMatrixPtr
&
in
,
MKLDNNMatrixPtr
&
in
,
const
std
::
shared_ptr
<
mkldnn
::
memory
::
primitive_desc
>&
intPD
=
nullptr
,
const
std
::
shared_ptr
<
mkldnn
::
memory
::
primitive_desc
>&
intPD
=
nullptr
,
size_t
inputIdx
=
0
);
size_t
inputIdx
=
0
,
int
inputChannel
=
0
);
/**
/**
* reset output value from internal primitive desc.
* reset output value from internal primitive desc.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录