Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
fe581b0e
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fe581b0e
编写于
9月 28, 2019
作者:
A
Adam
提交者:
Tao Luo
9月 28, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor GetMKLDNNFormat changes (#20055)
test=develop
上级
54e07994
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
14 addition
and
36 deletion
+14
-36
paddle/fluid/operators/elementwise/mkldnn/elementwise_add_mkldnn_op.cc
...operators/elementwise/mkldnn/elementwise_add_mkldnn_op.cc
+1
-3
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
+1
-6
paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc
paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc
+4
-3
paddle/fluid/operators/mkldnn/lrn_mkldnn_op.cc
paddle/fluid/operators/mkldnn/lrn_mkldnn_op.cc
+2
-12
paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc
paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc
+4
-3
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
+2
-9
未找到文件。
paddle/fluid/operators/elementwise/mkldnn/elementwise_add_mkldnn_op.cc
浏览文件 @
fe581b0e
...
...
@@ -167,9 +167,7 @@ class EltwiseAddMKLDNNKernel : public framework::OpKernel<T> {
stream
(
stream
::
kind
::
eager
).
submit
(
pipeline
).
wait
();
z
->
set_layout
(
DataLayout
::
kMKLDNN
);
z
->
set_format
((
MKLDNNMemoryFormat
)
dst_memory
->
get_primitive_desc
()
.
desc
()
.
data
.
format
);
z
->
set_format
(
platform
::
GetMKLDNNFormat
(
*
dst_memory
));
}
}
};
...
...
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
浏览文件 @
fe581b0e
...
...
@@ -47,11 +47,6 @@ static memory::primitive_desc CreateMemPrimDesc(const Tensor& input,
return
mem_prim_desc
;
}
static
MKLDNNMemoryFormat
GetDstMemFormat
(
const
concat
::
primitive_desc
&
concat_pd
)
{
return
(
MKLDNNMemoryFormat
)
concat_pd
.
dst_primitive_desc
().
desc
().
data
.
format
;
}
static
platform
::
CPUPlace
GetCpuPlace
(
const
paddle
::
framework
::
ExecutionContext
&
ctx
)
{
auto
place
=
ctx
.
GetPlace
();
...
...
@@ -198,7 +193,7 @@ class ConcatMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
stream
(
stream
::
kind
::
eager
).
submit
({
*
concat_p
}).
wait
();
output
->
set_layout
(
DataLayout
::
kMKLDNN
);
output
->
set_format
(
GetDstMemFormat
(
*
concat_pd
));
output
->
set_format
(
platform
::
GetMKLDNNFormat
(
*
dst_mem
));
}
};
}
// namespace operators
...
...
paddle/fluid/operators/mkldnn/fc_mkldnn_op.cc
浏览文件 @
fe581b0e
...
...
@@ -71,7 +71,7 @@ class FCPrimitiveFactory {
input_
->
set_data_handle
(
const_cast
<
T
*>
(
in
->
data
<
T
>
()));
output_
->
set_data_handle
(
out
->
mutable_data
<
T
>
(
ctx
.
GetPlace
()));
if
(
out
->
format
()
==
MKLDNNMemoryFormat
::
format_undef
)
{
auto
output_format
=
output_
->
get_primitive_desc
().
desc
().
data
.
format
;
auto
output_format
=
platform
::
GetMKLDNNFormat
(
*
output_
)
;
out
->
set_format
((
MKLDNNMemoryFormat
)
output_format
);
}
}
...
...
@@ -199,8 +199,9 @@ class FCPrimitiveFactory {
auto
dst_prim_desc
=
fc_prim_desc
.
dst_primitive_desc
();
auto
buffer_size
=
dst_prim_desc
.
get_size
();
T
*
output_data
=
output
->
mutable_data
<
T
>
(
ctx
.
GetPlace
(),
buffer_size
);
output
->
set_format
((
MKLDNNMemoryFormat
)
dst_prim_desc
.
desc
().
data
.
format
);
return
memory
(
dst_prim_desc
,
to_void_cast
<
T
>
(
output_data
));
memory
dst_mem
(
dst_prim_desc
,
to_void_cast
<
T
>
(
output_data
));
output
->
set_format
(
platform
::
GetMKLDNNFormat
(
dst_mem
));
return
dst_mem
;
}
void
RecomputeOutputDims
(
const
ExecutionContext
&
ctx
,
const
LoDTensor
*
input
,
...
...
paddle/fluid/operators/mkldnn/lrn_mkldnn_op.cc
浏览文件 @
fe581b0e
...
...
@@ -77,13 +77,8 @@ class LRNMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
std
::
vector
<
mkldnn
::
primitive
>
pipeline
=
{
*
lrn_p
};
mkldnn
::
stream
(
mkldnn
::
stream
::
kind
::
eager
).
submit
(
pipeline
).
wait
();
auto
output_format
=
(
mkldnn
::
memory
::
format
)
dst_memory
->
get_primitive_desc
()
.
desc
()
.
data
.
format
;
out
->
set_layout
(
framework
::
DataLayout
::
kMKLDNN
);
out
->
set_format
(
output_format
);
out
->
set_format
(
platform
::
GetMKLDNNFormat
(
*
dst_memory
)
);
}
};
...
...
@@ -129,13 +124,8 @@ class LRNMKLDNNGradOpKernel : public paddle::framework::OpKernel<T> {
std
::
vector
<
mkldnn
::
primitive
>
pipeline
=
{
*
lrn_bwd
};
mkldnn
::
stream
(
mkldnn
::
stream
::
kind
::
eager
).
submit
(
pipeline
).
wait
();
auto
output_format
=
(
mkldnn
::
memory
::
format
)
diff_src_memory
->
get_primitive_desc
()
.
desc
()
.
data
.
format
;
x_grad
->
set_layout
(
framework
::
DataLayout
::
kMKLDNN
);
x_grad
->
set_format
(
output_format
);
x_grad
->
set_format
(
platform
::
GetMKLDNNFormat
(
*
diff_src_memory
)
);
}
};
}
// namespace operators
...
...
paddle/fluid/operators/mkldnn/mul_mkldnn_op.cc
浏览文件 @
fe581b0e
...
...
@@ -107,7 +107,7 @@ class MulPrimitiveFactory {
output_
->
set_data_handle
(
out
->
mutable_data
<
OT
>
(
ctx
.
GetPlace
()));
if
(
out
->
format
()
==
MKLDNNMemoryFormat
::
format_undef
)
{
auto
output_format
=
output_
->
get_primitive_desc
().
desc
().
data
.
format
;
auto
output_format
=
platform
::
GetMKLDNNFormat
(
*
output_
)
;
out
->
set_format
((
MKLDNNMemoryFormat
)
output_format
);
}
}
...
...
@@ -139,8 +139,9 @@ class MulPrimitiveFactory {
auto
buffer_size
=
dst_prim_desc
.
get_size
();
OT
*
output_data
=
output
->
mutable_data
<
OT
>
(
ctx
.
GetPlace
(),
buffer_size
);
output
->
set_format
((
MKLDNNMemoryFormat
)
dst_prim_desc
.
desc
().
data
.
format
);
return
memory
(
dst_prim_desc
,
to_void_cast
<
OT
>
(
output_data
));
memory
dst_mem
(
dst_prim_desc
,
to_void_cast
<
OT
>
(
output_data
));
output
->
set_format
(
platform
::
GetMKLDNNFormat
(
dst_mem
));
return
dst_mem
;
}
memory
Reorder
(
const
memory
::
desc
&
src_desc
,
const
memory
::
desc
&
dst_desc
,
...
...
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
浏览文件 @
fe581b0e
...
...
@@ -95,11 +95,8 @@ class PoolMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
std
::
vector
<
mkldnn
::
primitive
>
pipeline
{
*
pool_p
};
stream
(
stream
::
kind
::
eager
).
submit
(
pipeline
).
wait
();
auto
output_format
=
(
MKLDNNMemoryFormat
)
dst_memory
->
get_primitive_desc
().
desc
().
data
.
format
;
output
->
set_layout
(
DataLayout
::
kMKLDNN
);
output
->
set_format
(
output_format
);
output
->
set_format
(
platform
::
GetMKLDNNFormat
(
*
dst_memory
)
);
}
};
...
...
@@ -179,12 +176,8 @@ class PoolMKLDNNGradOpKernel : public paddle::framework::OpKernel<T> {
pipeline
.
push_back
(
*
pool_bwd_p
);
mkldnn
::
stream
(
mkldnn
::
stream
::
kind
::
eager
).
submit
(
pipeline
).
wait
();
auto
in_x_grad_format
=
(
MKLDNNMemoryFormat
)
diff_src_memory
->
get_primitive_desc
()
.
desc
()
.
data
.
format
;
in_x_grad
->
set_layout
(
DataLayout
::
kMKLDNN
);
in_x_grad
->
set_format
(
in_x_grad_format
);
in_x_grad
->
set_format
(
platform
::
GetMKLDNNFormat
(
*
diff_src_memory
)
);
}
// Compute()
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录