Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
d3f8ede0
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看板
未验证
提交
d3f8ede0
编写于
12月 01, 2022
作者:
Z
zhoutianzi666
提交者:
GitHub
12月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Paddle Inference] remove conv_act_set from graph_pattern_detector.cc (#48569)
* remove conv_act_set from graph_pattern_detector.cc
上级
2bdad6cd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
13 deletion
+24
-13
paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc
...fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc
+8
-1
paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc
.../fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc
+8
-1
paddle/fluid/framework/ir/graph_pattern_detector.cc
paddle/fluid/framework/ir/graph_pattern_detector.cc
+4
-9
paddle/fluid/framework/ir/graph_pattern_detector.h
paddle/fluid/framework/ir/graph_pattern_detector.h
+4
-2
未找到文件。
paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc
浏览文件 @
d3f8ede0
...
...
@@ -131,8 +131,15 @@ void ConvElementwiseAdd2ActFusePass::ApplyImpl(ir::Graph* graph) const {
auto
*
x
=
gpd
.
mutable_pattern
()
->
NewNode
(
"x"
)
->
AsInput
()
->
assert_is_op_input
(
"conv2d"
,
"Input"
);
#if CUDNN_VERSION >= 8000
std
::
unordered_set
<
std
::
string
>
cudnn_act_set
(
{
"identity"
,
"relu"
,
"sigmoid"
,
"tanh"
});
#else
std
::
unordered_set
<
std
::
string
>
cudnn_act_set
({
"identity"
,
"relu"
});
#endif
patterns
::
ConvElementwiseadd2Act
pattern
(
gpd
.
mutable_pattern
(),
pattern_name
);
pattern
(
x
);
pattern
(
x
,
cudnn_act_set
);
auto
handler
=
[
&
](
const
GraphPatternDetector
::
subgraph_t
&
subgraph
,
Graph
*
g
)
{
...
...
paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc
浏览文件 @
d3f8ede0
...
...
@@ -130,8 +130,15 @@ void ConvElementwiseAddActFusePass::ApplyImpl(ir::Graph* graph) const {
->
assert_is_op_input
(
"conv2d"
,
"Input"
)
->
AsInput
();
#if CUDNN_VERSION >= 8000
std
::
unordered_set
<
std
::
string
>
cudnn_act_set
(
{
"identity"
,
"relu"
,
"sigmoid"
,
"tanh"
});
#else
std
::
unordered_set
<
std
::
string
>
cudnn_act_set
({
"identity"
,
"relu"
});
#endif
patterns
::
ConvElementwiseaddAct
pattern
(
gpd
.
mutable_pattern
(),
pattern_name
);
pattern
(
x
);
pattern
(
x
,
cudnn_act_set
);
auto
handler
=
[
&
](
const
GraphPatternDetector
::
subgraph_t
&
subgraph
,
Graph
*
g
)
{
...
...
paddle/fluid/framework/ir/graph_pattern_detector.cc
浏览文件 @
d3f8ede0
...
...
@@ -2372,14 +2372,8 @@ PDNode *patterns::PriorBox::operator()() {
return
boxes_var
;
}
#if CUDNN_VERSION >= 8000
std
::
unordered_set
<
std
::
string
>
conv_act_set
(
{
"identity"
,
"relu"
,
"sigmoid"
,
"tanh"
});
#else
std
::
unordered_set
<
std
::
string
>
conv_act_set
({
"identity"
,
"relu"
});
#endif
PDNode
*
patterns
::
ConvElementwiseaddAct
::
operator
()(
PDNode
*
conv_in
)
{
PDNode
*
patterns
::
ConvElementwiseaddAct
::
operator
()(
PDNode
*
conv_in
,
const
std
::
unordered_set
<
std
::
string
>
&
conv_act_set
)
{
conv_in
->
AsInput
();
auto
conv_op
=
pattern
->
NewNode
(
conv_op_repr
())
->
assert_is_op
(
"conv2d"
);
auto
conv_out
=
pattern
->
NewNode
(
conv_out_repr
())
...
...
@@ -2576,7 +2570,8 @@ PDNode *patterns::VitAttention::operator()(PDNode *in) {
return
reshape2_out
;
}
PDNode
*
patterns
::
ConvElementwiseadd2Act
::
operator
()(
PDNode
*
conv_in
)
{
PDNode
*
patterns
::
ConvElementwiseadd2Act
::
operator
()(
PDNode
*
conv_in
,
const
std
::
unordered_set
<
std
::
string
>
&
conv_act_set
)
{
auto
conv_op
=
pattern
->
NewNode
(
conv_op_repr
())
->
assert_is_op
(
"conv2d"
);
auto
conv_filter
=
pattern
->
NewNode
(
conv_filter_repr
())
->
assert_is_op_input
(
"conv2d"
,
"Filter"
)
...
...
paddle/fluid/framework/ir/graph_pattern_detector.h
浏览文件 @
d3f8ede0
...
...
@@ -1476,7 +1476,8 @@ struct ConvElementwiseaddAct : public PatternBase {
ConvElementwiseaddAct
(
PDPattern
*
pattern
,
const
std
::
string
&
name_scope
)
:
PatternBase
(
pattern
,
name_scope
,
"conv_elementwiseadd_act"
)
{}
PDNode
*
operator
()(
PDNode
*
conv_in
);
PDNode
*
operator
()(
PDNode
*
conv_in
,
const
std
::
unordered_set
<
std
::
string
>&
conv_act_set
);
PATTERN_DECL_NODE
(
conv_op
);
PATTERN_DECL_NODE
(
conv_out
);
...
...
@@ -1496,7 +1497,8 @@ struct ConvElementwiseadd2Act : public PatternBase {
:
PatternBase
(
pattern
,
name_scope
,
"conv_elementwiseadd2_elementwiseadd_act"
)
{}
PDNode
*
operator
()(
PDNode
*
conv_in
);
PDNode
*
operator
()(
PDNode
*
conv_in
,
const
std
::
unordered_set
<
std
::
string
>&
conv_act_set
);
PATTERN_DECL_NODE
(
conv_op
);
PATTERN_DECL_NODE
(
conv_filter
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录