Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞不过沧海
Paddle
提交
240d974a
P
Paddle
项目概览
飞不过沧海
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
240d974a
编写于
12月 07, 2018
作者:
Y
Yihua Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean Code
test=develop
上级
82eefcea
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
61 deletion
+24
-61
paddle/fluid/framework/ir/CMakeLists.txt
paddle/fluid/framework/ir/CMakeLists.txt
+0
-1
paddle/fluid/framework/ir/conv3d_bias_mkldnn_fuse_pass.cc
paddle/fluid/framework/ir/conv3d_bias_mkldnn_fuse_pass.cc
+0
-18
paddle/fluid/framework/ir/conv3d_bias_mkldnn_fuse_pass.h
paddle/fluid/framework/ir/conv3d_bias_mkldnn_fuse_pass.h
+0
-29
paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.cc
paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.cc
+2
-0
paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.h
paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.h
+7
-0
paddle/fluid/framework/ir/graph_pattern_detector.cc
paddle/fluid/framework/ir/graph_pattern_detector.cc
+11
-13
paddle/fluid/operators/activation_mkldnn_op.cc
paddle/fluid/operators/activation_mkldnn_op.cc
+4
-0
未找到文件。
paddle/fluid/framework/ir/CMakeLists.txt
浏览文件 @
240d974a
...
...
@@ -46,7 +46,6 @@ if(WITH_MKLDNN)
pass_library
(
mkldnn_placement_pass base
)
pass_library
(
depthwise_conv_mkldnn_pass base
)
pass_library
(
conv_bias_mkldnn_fuse_pass inference
)
pass_library
(
conv3d_bias_mkldnn_fuse_pass inference
)
pass_library
(
conv_relu_mkldnn_fuse_pass inference
)
pass_library
(
conv_elementwise_add_mkldnn_fuse_pass inference
)
endif
()
...
...
paddle/fluid/framework/ir/conv3d_bias_mkldnn_fuse_pass.cc
已删除
100644 → 0
浏览文件 @
82eefcea
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/fluid/framework/ir/conv3d_bias_mkldnn_fuse_pass.h"
REGISTER_PASS
(
conv3d_bias_mkldnn_fuse_pass
,
paddle
::
framework
::
ir
::
Conv3DBiasFusePass
);
paddle/fluid/framework/ir/conv3d_bias_mkldnn_fuse_pass.h
已删除
100644 → 0
浏览文件 @
82eefcea
// Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.h"
namespace
paddle
{
namespace
framework
{
namespace
ir
{
/*
* Fuse the Conv3D and Elementwise_add to a Conv3DBiasOp.
*/
class
Conv3DBiasFusePass
:
public
ConvBiasFusePass
{
public:
bool
is_conv3d
()
const
override
{
return
true
;
}
};
}
// namespace ir
}
// namespace framework
}
// namespace paddle
paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.cc
浏览文件 @
240d974a
...
...
@@ -137,3 +137,5 @@ std::unique_ptr<ir::Graph> ConvBiasFusePass::ApplyImpl(
}
// namespace paddle
REGISTER_PASS
(
conv_bias_mkldnn_fuse_pass
,
paddle
::
framework
::
ir
::
ConvBiasFusePass
);
REGISTER_PASS
(
conv3d_bias_mkldnn_fuse_pass
,
paddle
::
framework
::
ir
::
Conv3DBiasFusePass
);
paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.h
浏览文件 @
240d974a
...
...
@@ -32,6 +32,13 @@ class ConvBiasFusePass : public FusePassBase {
std
::
unique_ptr
<
ir
::
Graph
>
ApplyImpl
(
std
::
unique_ptr
<
ir
::
Graph
>
graph
)
const
;
const
std
::
string
name_scope_
{
"conv_bias_mkldnn_fuse"
};
};
/*
* Fuse the Conv3D and Elementwise_add to a Conv3DBiasOp.
*/
class
Conv3DBiasFusePass
:
public
ConvBiasFusePass
{
public:
bool
is_conv3d
()
const
override
{
return
true
;
}
};
}
// namespace ir
}
// namespace framework
}
// namespace paddle
paddle/fluid/framework/ir/graph_pattern_detector.cc
浏览文件 @
240d974a
...
...
@@ -1031,25 +1031,23 @@ PDNode *patterns::ElewiseAddActInplaceGrad::operator()(
PDNode
*
patterns
::
ConvBias
::
operator
()(
paddle
::
framework
::
ir
::
PDNode
*
conv_input
,
bool
is_conv3d
)
{
std
::
string
type
=
is_conv3d
?
"conv3d"
:
"conv2d"
;
// Create Operators
conv_input
->
assert_is_op_input
(
is_conv3d
?
"conv3d"
:
"conv2d"
,
"Input"
);
auto
*
conv_op
=
pattern
->
NewNode
(
conv_repr
())
->
assert_is_op
(
is_conv3d
?
"conv3d"
:
"conv2d"
);
conv_input
->
assert_is_op_input
(
type
,
"Input"
);
auto
*
conv_op
=
pattern
->
NewNode
(
conv_repr
())
->
assert_is_op
(
type
);
auto
*
eltiwse_op
=
pattern
->
NewNode
(
eltwise_repr
())
->
assert_is_op
(
"elementwise_add"
);
// Create variables
// Filter
auto
*
conv_weight_var
=
pattern
->
NewNode
(
conv_weight_repr
())
->
AsInput
()
->
assert_is_persistable_var
()
->
assert_is_op_input
(
is_conv3d
?
"conv3d"
:
"conv2d"
,
"Filter"
);
auto
*
conv_weight_var
=
pattern
->
NewNode
(
conv_weight_repr
())
->
AsInput
()
->
assert_is_persistable_var
()
->
assert_is_op_input
(
type
,
"Filter"
);
// intermediate variable, will be removed in the IR after fuse.
auto
*
conv_out_var
=
pattern
->
NewNode
(
conv_out_repr
())
->
AsIntermediate
()
->
assert_is_only_output_of_op
(
is_conv3d
?
"conv3d"
:
"conv2d"
)
->
assert_is_op_input
(
"elementwise_add"
);
auto
*
conv_out_var
=
pattern
->
NewNode
(
conv_out_repr
())
->
AsIntermediate
()
->
assert_is_only_output_of_op
(
type
)
->
assert_is_op_input
(
"elementwise_add"
);
// Bias stored in elementwise_add
auto
*
eltwise_bias_var
=
pattern
->
NewNode
(
eltwise_bias_repr
())
->
AsInput
()
...
...
paddle/fluid/operators/activation_mkldnn_op.cc
浏览文件 @
240d974a
...
...
@@ -100,6 +100,10 @@ void eltwise_forward(const framework::ExecutionContext &ctx,
const
T
*
x_data
=
x
->
data
<
T
>
();
T
*
y_data
=
y
->
mutable_data
<
T
>
(
ctx
.
GetPlace
());
PADDLE_ENFORCE
(
x
->
dims
().
size
()
==
2
||
x
->
dims
().
size
()
==
3
||
x
->
dims
().
size
()
==
4
,
"Input dim must be with 2, 3 or 4"
);
std
::
vector
<
int
>
src_tz
=
framework
::
vectorize2int
(
x
->
dims
());
auto
src_format
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录