Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
66fdbd0c
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看板
提交
66fdbd0c
编写于
9月 13, 2017
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add some comment and simplify some code
上级
44acc751
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
27 deletion
+18
-27
paddle/gserver/layers/MKLDNNConvLayer.cpp
paddle/gserver/layers/MKLDNNConvLayer.cpp
+2
-2
paddle/gserver/layers/MKLDNNConvLayer.h
paddle/gserver/layers/MKLDNNConvLayer.h
+8
-16
paddle/math/MKLDNNMatrix.cpp
paddle/math/MKLDNNMatrix.cpp
+1
-5
paddle/math/MKLDNNMatrix.h
paddle/math/MKLDNNMatrix.h
+6
-0
python/paddle/trainer/config_parser.py
python/paddle/trainer/config_parser.py
+1
-4
未找到文件。
paddle/gserver/layers/MKLDNNConvLayer.cpp
浏览文件 @
66fdbd0c
...
...
@@ -47,9 +47,9 @@ bool MKLDNNConvLayer::init(const LayerMap& layerMap,
sw_
=
conf
.
stride
();
sh_
=
conf
.
stride_y
();
gp_
=
conf
.
groups
();
oh_
=
conf
.
has_output_y
()
?
conf
.
output_y
()
:
conf
.
output_x
();
oh_
=
conf
.
output_y
();
ow_
=
conf
.
output_x
();
ih_
=
conf
.
has_img_size_y
()
?
conf
.
img_size_y
()
:
conf
.
img_size
();
ih_
=
conf
.
img_size_y
();
iw_
=
conf
.
img_size
();
caffeMode_
=
conf
.
caffe_mode
();
CHECK
(
caffeMode_
)
<<
"Only support caffe mode yet"
;
...
...
paddle/gserver/layers/MKLDNNConvLayer.h
浏览文件 @
66fdbd0c
...
...
@@ -37,38 +37,30 @@ protected:
// group number
int
gp_
;
// in
backward data the format
is different with wgtVal_
// in
resetBwdData, the format of wgtValBwdData_
is different with wgtVal_
MKLDNNMatrixPtr
wgtValBwdData_
;
// convert handle from wgtVal_ to wgtValBwdData_
std
::
shared_ptr
<
mkldnn
::
reorder
>
cvtWgtVal_
;
// save forward primitive_desc
use for
backward
// save forward primitive_desc
, which can be used
backward
std
::
shared_ptr
<
mkldnn
::
convolution_forward
::
primitive_desc
>
fwdPD_
;
// MKLDNNMatrixPtr w
ith cpu device for conversion between MKLDNN d
evice
// MKLDNNMatrixPtr w
hich should be created from CPU D
evice
MKLDNNMatrixPtr
cpuInVal_
;
MKLDNNMatrixPtr
cpuInGrad_
;
MKLDNNMatrixPtr
cpuOutVal_
;
MKLDNNMatrixPtr
cpuOutGrad_
;
// convert handle between CPU device and MKLDNN device
std
::
shared_ptr
<
mkldnn
::
reorder
>
cvtInVal_
;
std
::
shared_ptr
<
mkldnn
::
reorder
>
cvtInGrad_
;
std
::
shared_ptr
<
mkldnn
::
reorder
>
cvtOutVal_
;
std
::
shared_ptr
<
mkldnn
::
reorder
>
cvtOutGrad_
;
//
if has already init the weigh
t
//
whether the weight has been ini
t
bool
hasInitedWgt_
;
// True by default. This impact the calculation of output size.
// For example:
// - input(+padding): 0123456789
// - imageSize(+padding) = 10;
// - filterSize = 3;
// - stride = 2;
// - caffeMode_ is true:
// - output: (012), (234), (456), (678)
// - outputSize = 4;
// - caffeMode_ is false:
// - output: (012), (234), (456), (678), (9)
// - outputSize = 5;
// true by default, which impact the calculation of output image size.
// details can refer to mathUtil.h
bool
caffeMode_
;
// weight and bias
...
...
paddle/math/MKLDNNMatrix.cpp
浏览文件 @
66fdbd0c
...
...
@@ -52,11 +52,7 @@ MKLDNNMatrixPtr MKLDNNMatrix::create(MatrixPtr m,
std
::
shared_ptr
<
reorder
>
MKLDNNMatrix
::
createReorder
(
const
MKLDNNMatrixPtr
&
src
,
const
MKLDNNMatrixPtr
&
dst
,
bool
checkData
)
{
if
(
src
==
dst
)
{
return
nullptr
;
}
if
(
src
->
getPrimitiveDesc
()
==
dst
->
getPrimitiveDesc
())
{
if
(
src
==
dst
||
src
->
getPrimitiveDesc
()
==
dst
->
getPrimitiveDesc
())
{
return
nullptr
;
}
...
...
paddle/math/MKLDNNMatrix.h
浏览文件 @
66fdbd0c
...
...
@@ -65,6 +65,12 @@ public:
/**
* Create reorder primitive.
* Create a mkldnn::reorder handle for converting src MKLDNNMatrix to dst.
* checkData: for whether to check the data handle of src and dst is the same.
* if true, means check it and do not want support inplace reorder;
* otherwise do not check data which means the created reorder
* maybe inplace buffer and do not guarantee the logical is correct
* since not all format or conversion support inplace.
*/
static
std
::
shared_ptr
<
mkldnn
::
reorder
>
createReorder
(
const
MKLDNNMatrixPtr
&
src
,
...
...
python/paddle/trainer/config_parser.py
浏览文件 @
66fdbd0c
...
...
@@ -2073,10 +2073,7 @@ class ConvLayerBase(LayerBase):
(
parallel_nn
==
0
or
self
.
config
.
device
>
-
1
)):
self
.
layer_type
=
"cudnn_conv"
else
:
if
(
use_mkldnn
==
1
):
self
.
layer_type
=
"mkldnn_conv"
else
:
self
.
layer_type
=
"exconv"
self
.
layer_type
=
"mkldnn_conv"
if
use_mkldnn
else
"exconv"
# need to specify layer in config
self
.
config
.
type
=
self
.
layer_type
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录