Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
90e9a486
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看板
未验证
提交
90e9a486
编写于
12月 22, 2021
作者:
W
wenbin
提交者:
GitHub
12月 22, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CE fix (#38324)
* CE fix * more format
上级
c9bc2758
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
6 deletion
+26
-6
paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc
paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc
+17
-4
paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc
...fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc
+1
-1
paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc
paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc
+8
-1
未找到文件。
paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc
浏览文件 @
90e9a486
...
@@ -130,7 +130,7 @@ ConvAffineChannelFusePass::ConvAffineChannelFusePass() {
...
@@ -130,7 +130,7 @@ ConvAffineChannelFusePass::ConvAffineChannelFusePass() {
.
IsType
<
std
::
vector
<
int
>>
()
.
IsType
<
std
::
vector
<
int
>>
()
.
End
()
.
End
()
.
AddAttr
(
"data_format"
)
.
AddAttr
(
"data_format"
)
.
IsStringIn
({
"NCHW"
/*, "NHWC", "AnyLayout"*/
})
.
IsStringIn
({
"NCHW"
,
"AnyLayout"
})
.
End
();
.
End
();
AddOpCompat
(
OpCompat
(
"affine_channel"
))
AddOpCompat
(
OpCompat
(
"affine_channel"
))
...
@@ -148,7 +148,7 @@ ConvAffineChannelFusePass::ConvAffineChannelFusePass() {
...
@@ -148,7 +148,7 @@ ConvAffineChannelFusePass::ConvAffineChannelFusePass() {
.
IsTensor
()
.
IsTensor
()
.
End
()
.
End
()
.
AddAttr
(
"data_layout"
)
.
AddAttr
(
"data_layout"
)
.
IsStringIn
({
"NCHW"
/*, "NHWC", "AnyLayout"*/
})
.
IsStringIn
({
"NCHW"
,
"AnyLayout"
})
.
End
();
.
End
();
AddOpCompat
(
OpCompat
(
"elementwise_add"
))
AddOpCompat
(
OpCompat
(
"elementwise_add"
))
...
@@ -197,6 +197,13 @@ void ConvAffineChannelFusePass::ApplyImpl(ir::Graph* graph) const {
...
@@ -197,6 +197,13 @@ void ConvAffineChannelFusePass::ApplyImpl(ir::Graph* graph) const {
GET_CONV_BN_NODES
(
conv_ac_pattern
);
GET_CONV_BN_NODES
(
conv_ac_pattern
);
auto
data_format
=
conv
->
Op
()
->
GetAttrIfExists
<
std
::
string
>
(
"data_format"
);
if
(
data_format
==
"AnyLayout"
)
{
LOG_FIRST_N
(
WARNING
,
1
)
<<
"conv_affine_channel_fuse_pass is enabled, "
"it's wrong if data_format of conv is not "
"NCHW."
;
}
// Get affine_channel bias for resizing eltwise_y!
// Get affine_channel bias for resizing eltwise_y!
auto
*
ac_bias_tensor
=
auto
*
ac_bias_tensor
=
scope
->
FindVar
(
ac_bias
->
Name
())
->
GetMutable
<
LoDTensor
>
();
scope
->
FindVar
(
ac_bias
->
Name
())
->
GetMutable
<
LoDTensor
>
();
...
@@ -282,7 +289,7 @@ ConvEltwiseAddAffineChannelFusePass::ConvEltwiseAddAffineChannelFusePass() {
...
@@ -282,7 +289,7 @@ ConvEltwiseAddAffineChannelFusePass::ConvEltwiseAddAffineChannelFusePass() {
.
IsType
<
std
::
vector
<
int
>>
()
.
IsType
<
std
::
vector
<
int
>>
()
.
End
()
.
End
()
.
AddAttr
(
"data_format"
)
.
AddAttr
(
"data_format"
)
.
IsStringIn
({
"NCHW"
/*, "NHWC", "AnyLayout"*/
})
.
IsStringIn
({
"NCHW"
,
"AnyLayout"
})
.
End
();
.
End
();
AddOpCompat
(
OpCompat
(
"affine_channel"
))
AddOpCompat
(
OpCompat
(
"affine_channel"
))
.
AddInput
(
"X"
)
.
AddInput
(
"X"
)
...
@@ -299,7 +306,7 @@ ConvEltwiseAddAffineChannelFusePass::ConvEltwiseAddAffineChannelFusePass() {
...
@@ -299,7 +306,7 @@ ConvEltwiseAddAffineChannelFusePass::ConvEltwiseAddAffineChannelFusePass() {
.
IsTensor
()
.
IsTensor
()
.
End
()
.
End
()
.
AddAttr
(
"data_layout"
)
.
AddAttr
(
"data_layout"
)
.
IsStringIn
({
"NCHW"
/*, "NHWC", "AnyLayout"*/
})
.
IsStringIn
({
"NCHW"
,
"AnyLayout"
})
.
End
();
.
End
();
AddOpCompat
(
OpCompat
(
"elementwise_add"
))
AddOpCompat
(
OpCompat
(
"elementwise_add"
))
.
AddInput
(
"X"
)
.
AddInput
(
"X"
)
...
@@ -347,6 +354,12 @@ void ConvEltwiseAddAffineChannelFusePass::ApplyImpl(ir::Graph* graph) const {
...
@@ -347,6 +354,12 @@ void ConvEltwiseAddAffineChannelFusePass::ApplyImpl(ir::Graph* graph) const {
VLOG
(
4
)
<<
"handle ConvBN fuse"
;
VLOG
(
4
)
<<
"handle ConvBN fuse"
;
GET_CONV_BN_NODES
(
conv_ac_pattern
);
GET_CONV_BN_NODES
(
conv_ac_pattern
);
auto
data_format
=
conv
->
Op
()
->
GetAttrIfExists
<
std
::
string
>
(
"data_format"
);
if
(
data_format
==
"AnyLayout"
)
{
LOG_FIRST_N
(
WARNING
,
1
)
<<
"conv_eltwiseadd_affine_channel_fuse_pass is "
"enabled, it's wrong if data_format of conv "
"is not NCHW."
;
}
// OPERATORS
// OPERATORS
GET_IR_NODE_FROM_SUBGRAPH
(
eltwise
,
eltwise
,
conv_ac_pattern
);
GET_IR_NODE_FROM_SUBGRAPH
(
eltwise
,
eltwise
,
conv_ac_pattern
);
// BIAS inputs
// BIAS inputs
...
...
paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc
浏览文件 @
90e9a486
...
@@ -77,7 +77,7 @@ ConvElementwiseAdd2ActFusePass::ConvElementwiseAdd2ActFusePass() {
...
@@ -77,7 +77,7 @@ ConvElementwiseAdd2ActFusePass::ConvElementwiseAdd2ActFusePass() {
.
AddAttr
(
"dilations"
)
.
AddAttr
(
"dilations"
)
.
End
()
.
End
()
.
AddAttr
(
"data_format"
)
.
AddAttr
(
"data_format"
)
.
IsStringIn
({
"NHWC"
,
"NCHW"
})
.
IsStringIn
({
"NHWC"
,
"NCHW"
,
"AnyLayout"
})
.
End
();
.
End
();
AddOpCompat
(
OpCompat
(
"elementwise_add"
))
AddOpCompat
(
OpCompat
(
"elementwise_add"
))
...
...
paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc
浏览文件 @
90e9a486
...
@@ -57,7 +57,7 @@ ConvElementwiseAddFusePass::ConvElementwiseAddFusePass() {
...
@@ -57,7 +57,7 @@ ConvElementwiseAddFusePass::ConvElementwiseAddFusePass() {
.
AddAttr
(
"dilations"
)
.
AddAttr
(
"dilations"
)
.
End
()
.
End
()
.
AddAttr
(
"data_format"
)
.
AddAttr
(
"data_format"
)
.
IsStringIn
({
"NCHW"
/*, "NHWC", "AnyLayout"*/
})
.
IsStringIn
({
"NCHW"
,
"AnyLayout"
})
.
End
();
.
End
();
AddOpCompat
(
OpCompat
(
"elementwise_add"
))
AddOpCompat
(
OpCompat
(
"elementwise_add"
))
...
@@ -97,6 +97,13 @@ void ConvElementwiseAddFusePass::ApplyImpl(ir::Graph* graph) const {
...
@@ -97,6 +97,13 @@ void ConvElementwiseAddFusePass::ApplyImpl(ir::Graph* graph) const {
GET_NODES
;
GET_NODES
;
auto
base_op_desc
=
*
conv_op
->
Op
()
->
Proto
();
auto
base_op_desc
=
*
conv_op
->
Op
()
->
Proto
();
auto
data_format
=
conv_op
->
Op
()
->
GetAttrIfExists
<
std
::
string
>
(
"data_format"
);
if
(
data_format
==
"AnyLayout"
)
{
LOG_FIRST_N
(
WARNING
,
1
)
<<
"conv_elementwise_add_fuse_pass is enabled, "
"it's wrong if data_format of conv is not "
"NCHW."
;
}
std
::
string
bias_name
=
elementwise_add_in_y
->
Name
();
std
::
string
bias_name
=
elementwise_add_in_y
->
Name
();
std
::
string
output_name
=
elementwise_add_out
->
Name
();
std
::
string
output_name
=
elementwise_add_out
->
Name
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录