Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f6a94093
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看板
提交
f6a94093
编写于
8月 08, 2017
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove unused comments, refine and rename
上级
abc49f74
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
13 addition
and
14 deletion
+13
-14
paddle/gserver/layers/MkldnnFcLayer.cpp
paddle/gserver/layers/MkldnnFcLayer.cpp
+2
-2
paddle/gserver/layers/MkldnnFcLayer.h
paddle/gserver/layers/MkldnnFcLayer.h
+2
-2
paddle/gserver/layers/MkldnnLayer.cpp
paddle/gserver/layers/MkldnnLayer.cpp
+4
-5
paddle/gserver/layers/MkldnnLayer.h
paddle/gserver/layers/MkldnnLayer.h
+2
-2
paddle/gserver/tests/MkldnnTester.cpp
paddle/gserver/tests/MkldnnTester.cpp
+1
-1
python/paddle/trainer/config_parser.py
python/paddle/trainer/config_parser.py
+2
-2
未找到文件。
paddle/gserver/layers/MkldnnFcLayer.cpp
浏览文件 @
f6a94093
...
...
@@ -50,7 +50,7 @@ bool MkldnnFcLayer::init(const LayerMap& layerMap,
return
true
;
}
void
MkldnnFcLayer
::
c
vtWgt
FromPaddle
()
{
void
MkldnnFcLayer
::
c
onvertWeights
FromPaddle
()
{
if
(
FLAGS_use_mkldnn_wgt
)
{
return
;
}
...
...
@@ -75,7 +75,7 @@ void MkldnnFcLayer::cvtWgtFromPaddle() {
hasInitedWgt_
=
true
;
}
void
MkldnnFcLayer
::
c
vtWgt
ToPaddle
()
{
void
MkldnnFcLayer
::
c
onvertWeights
ToPaddle
()
{
MatrixPtr
dnnWgt
=
weight_
->
getW
();
MatrixPtr
paddleWgt
;
dnnWgt
->
transpose
(
paddleWgt
,
true
);
...
...
paddle/gserver/layers/MkldnnFcLayer.h
浏览文件 @
f6a94093
...
...
@@ -44,9 +44,9 @@ public:
bool
init
(
const
LayerMap
&
layerMap
,
const
ParameterMap
&
parameterMap
)
override
;
void
c
vtWgt
FromPaddle
()
override
;
void
c
onvertWeights
FromPaddle
()
override
;
void
c
vtWgt
ToPaddle
()
override
;
void
c
onvertWeights
ToPaddle
()
override
;
void
forward
(
PassType
passType
)
override
;
...
...
paddle/gserver/layers/MkldnnLayer.cpp
浏览文件 @
f6a94093
...
...
@@ -14,7 +14,6 @@ limitations under the License. */
#include "MkldnnLayer.h"
// using namespace mkldnn; // NOLINT
using
mem
=
mkldnn
::
memory
;
// NOLINT
typedef
mem
::
format
format
;
typedef
mkldnn
::
inner_product_forward
fc_fwd
;
...
...
@@ -94,7 +93,7 @@ void MkldnnLayer::mkldnnForwardFC(int bs,
// if input size changed, reset it
resetForwardFC
(
bs
,
ic
,
ih
,
iw
,
botData
,
oc
,
topData
,
wgtData
,
biasData
);
this
->
c
vtWgt
FromPaddle
();
this
->
c
onvertWeights
FromPaddle
();
// update input, since the data might be changed if this is after data layer
inVal_
->
set_data_handle
(
botData
);
...
...
@@ -208,9 +207,9 @@ void MkldnnLayer::mkldnnBackwardFC(int bs,
}
void
MkldnnLayer
::
printSizeInfo
()
{
VLOG
(
DNN_SIZES
)
<<
"bs: "
<<
bs_
<<
", ic: "
<<
ic_
<<
", ih: "
<<
ih
_
<<
", i
w: "
<<
iw_
<<
", oc: "
<<
oc_
<<
", oh: "
<<
oh
_
<<
", ow: "
<<
ow_
;
VLOG
(
DNN_SIZES
)
<<
getName
()
<<
": bs: "
<<
bs_
<<
", ic: "
<<
ic
_
<<
", i
h: "
<<
ih_
<<
", iw: "
<<
iw_
<<
", oc: "
<<
oc
_
<<
", o
h: "
<<
oh_
<<
", o
w: "
<<
ow_
;
}
mem
::
desc
MkldnnLayer
::
createMD
(
mem
::
dims
dims
,
...
...
paddle/gserver/layers/MkldnnLayer.h
浏览文件 @
f6a94093
...
...
@@ -87,13 +87,13 @@ public:
* convert weight from paddle format to mkldnn format
* weight_ will be override
*/
virtual
void
c
vtWgtFromPaddle
()
{
;
}
virtual
void
c
onvertWeightsFromPaddle
()
{
}
/**
* convert mkldnn weight to paddle format
* weight_ will be override
*/
virtual
void
c
vtWgtToPaddle
()
{
;
}
virtual
void
c
onvertWeightsToPaddle
()
{
}
void
resetForwardFC
(
int
bs
,
int
ic
,
...
...
paddle/gserver/tests/MkldnnTester.cpp
浏览文件 @
f6a94093
...
...
@@ -149,7 +149,7 @@ void MkldnnTester::checkBackwardWgts() {
const
MkldnnLayerPtr
dnnlayer
=
std
::
dynamic_pointer_cast
<
MkldnnLayer
>
(
dnnLayer_
);
CHECK
(
dnnlayer
);
dnnlayer
->
c
vtWgt
ToPaddle
();
dnnlayer
->
c
onvertWeights
ToPaddle
();
for
(
size_t
i
=
0
;
i
<
parameters_
[
DNN
].
size
();
++
i
)
{
const
VectorPtr
&
dnn
=
parameters_
[
DNN
][
i
]
->
getBuf
(
PARAMETER_VALUE
);
const
VectorPtr
&
ref
=
parameters_
[
REF
][
i
]
->
getBuf
(
PARAMETER_VALUE
);
...
...
python/paddle/trainer/config_parser.py
浏览文件 @
f6a94093
...
...
@@ -1614,13 +1614,13 @@ class FCLayer(LayerBase):
error_clipping_threshold
=
None
,
**
xargs
):
use_mkldnn
=
bool
(
int
(
g_command_config_args
.
get
(
"use_mkldnn"
,
0
)))
use_mkldnn_wgt
=
bool
(
int
(
g_command_config_args
.
get
(
"use_mkldnn_wgt"
,
0
)))
if
use_mkldnn
:
self
.
layer_type
=
'mkldnn_fc'
config_assert
(
len
(
inputs
)
==
1
,
"MkldnnFCLayer support one and only one input!"
)
use_mkldnn_wgt
=
bool
(
int
(
g_command_config_args
.
get
(
"use_mkldnn_wgt"
,
0
)))
super
(
FCLayer
,
self
).
__init__
(
name
,
self
.
layer_type
,
size
,
inputs
=
inputs
,
**
xargs
)
for
input_index
in
xrange
(
len
(
self
.
inputs
)):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录