Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
cbe122ae
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
12 个月 前同步成功
通知
692
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cbe122ae
编写于
9月 19, 2018
作者:
T
Tomasz Patejko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MKLDNN conv + elementwise_add fusion: correcting formatting
上级
2a251bbf
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
10 deletion
+11
-10
paddle/fluid/framework/ir/conv_elementwise_add_mkldnn_fuse_pass.cc
...uid/framework/ir/conv_elementwise_add_mkldnn_fuse_pass.cc
+11
-10
未找到文件。
paddle/fluid/framework/ir/conv_elementwise_add_mkldnn_fuse_pass.cc
浏览文件 @
cbe122ae
...
@@ -58,13 +58,13 @@ struct Conv {
...
@@ -58,13 +58,13 @@ struct Conv {
auto
conv_op
=
pattern
->
new_node
(
op_name
())
->
assert_is_op
(
op_name
());
auto
conv_op
=
pattern
->
new_node
(
op_name
())
->
assert_is_op
(
op_name
());
auto
input_var
=
pattern
->
new_node
(
input_name
())
auto
input_var
=
pattern
->
new_node
(
input_name
())
->
assert_is_op_input
(
op_name
(),
input_name
());
->
assert_is_op_input
(
op_name
(),
input_name
());
auto
filter_var
=
pattern
->
new_node
(
filter_name
())
auto
filter_var
=
pattern
->
new_node
(
filter_name
())
->
assert_is_op_input
(
op_name
(),
filter_name
());
->
assert_is_op_input
(
op_name
(),
filter_name
());
auto
output_var
=
pattern
->
new_node
(
output_name
())
auto
output_var
=
pattern
->
new_node
(
output_name
())
->
assert_is_op_output
(
op_name
(),
output_name
());
->
assert_is_op_output
(
op_name
(),
output_name
());
conv_op
->
LinksFrom
({
input_var
,
filter_var
});
conv_op
->
LinksFrom
({
input_var
,
filter_var
});
conv_op
->
LinksTo
({
output_var
});
conv_op
->
LinksTo
({
output_var
});
...
@@ -91,8 +91,8 @@ struct ElementwiseAdd {
...
@@ -91,8 +91,8 @@ struct ElementwiseAdd {
conv_output
->
assert_is_op_input
(
op_name
(),
y_name
());
conv_output
->
assert_is_op_input
(
op_name
(),
y_name
());
auto
out_var
=
pattern
->
new_node
(
out_name
())
auto
out_var
=
pattern
->
new_node
(
out_name
())
->
AsOutput
()
->
AsOutput
()
->
assert_is_op_output
(
op_name
(),
out_name
());
->
assert_is_op_output
(
op_name
(),
out_name
());
elementwise_add_op
->
LinksFrom
({
x_var
,
conv_output
});
elementwise_add_op
->
LinksFrom
({
x_var
,
conv_output
});
elementwise_add_op
->
LinksTo
({
out_var
});
elementwise_add_op
->
LinksTo
({
out_var
});
...
@@ -179,15 +179,15 @@ graph_ptr ConvElementwiseAddMKLDNNFusePass::ApplyImpl(graph_ptr graph) const {
...
@@ -179,15 +179,15 @@ graph_ptr ConvElementwiseAddMKLDNNFusePass::ApplyImpl(graph_ptr graph) const {
conv_output
->
AsIntermediate
();
conv_output
->
AsIntermediate
();
auto
fuse_conv
=
[
&
conv_pattern
](
Graph
*
g
,
Node
*
conv_input
,
auto
fuse_conv
=
[
&
conv_pattern
](
Graph
*
g
,
Node
*
conv_input
,
Node
*
conv_filter
,
Node
*
conv_filter
,
Node
*
conv_output
,
Node
*
conv_output
,
Node
*
elementwise_add_x
)
{
Node
*
elementwise_add_x
)
{
OpDesc
op_desc
;
OpDesc
op_desc
;
op_desc
.
SetType
(
conv_pattern
.
op_name
());
op_desc
.
SetType
(
conv_pattern
.
op_name
());
op_desc
.
SetInput
(
conv_pattern
.
input_name
(),
{
conv_input
->
Name
()});
op_desc
.
SetInput
(
conv_pattern
.
input_name
(),
{
conv_input
->
Name
()});
op_desc
.
SetInput
(
conv_pattern
.
filter_name
(),
{
conv_filter
->
Name
()});
op_desc
.
SetInput
(
conv_pattern
.
filter_name
(),
{
conv_filter
->
Name
()});
op_desc
.
SetInput
(
conv_pattern
.
residual_data_name
(),
{
elementwise_add_x
->
Name
()});
op_desc
.
SetInput
(
conv_pattern
.
residual_data_name
(),
{
elementwise_add_x
->
Name
()});
op_desc
.
SetOutput
(
conv_pattern
.
output_name
(),
{
conv_output
->
Name
()});
op_desc
.
SetOutput
(
conv_pattern
.
output_name
(),
{
conv_output
->
Name
()});
op_desc
.
SetAttr
(
"use_mkldnn"
,
true
);
op_desc
.
SetAttr
(
"use_mkldnn"
,
true
);
...
@@ -201,8 +201,9 @@ graph_ptr ConvElementwiseAddMKLDNNFusePass::ApplyImpl(graph_ptr graph) const {
...
@@ -201,8 +201,9 @@ graph_ptr ConvElementwiseAddMKLDNNFusePass::ApplyImpl(graph_ptr graph) const {
patterns
::
LinkNodes
(
fused_conv_op
,
conv_output
);
patterns
::
LinkNodes
(
fused_conv_op
,
conv_output
);
};
};
auto
handler
=
[
&
conv_pattern
,
&
elementwise_add_pattern
,
pattern_ptr
,
fuse_conv
]
auto
handler
=
[
&
conv_pattern
,
&
elementwise_add_pattern
,
pattern_ptr
,
(
const
GraphPatternDetector
::
subgraph_t
&
subgraph
,
Graph
*
g
)
{
fuse_conv
](
const
GraphPatternDetector
::
subgraph_t
&
subgraph
,
Graph
*
g
)
{
auto
conv_op
=
patterns
::
GetNodeFromSubgraph
(
subgraph
,
pattern_ptr
,
auto
conv_op
=
patterns
::
GetNodeFromSubgraph
(
subgraph
,
pattern_ptr
,
conv_pattern
.
op_name
());
conv_pattern
.
op_name
());
auto
conv_input
=
patterns
::
GetNodeFromSubgraph
(
subgraph
,
pattern_ptr
,
auto
conv_input
=
patterns
::
GetNodeFromSubgraph
(
subgraph
,
pattern_ptr
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录