Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
c810ad2e
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c810ad2e
编写于
10月 31, 2019
作者:
Y
Yuan Shuai
提交者:
GitHub
10月 31, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[BugFix] Fix conv bn bug, check bias in pass (#2313)
* Fix conv bn bug. test=develop * Fix bug in pattern_matcher. test=develop
上级
2c380625
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
6 addition
and
4 deletion
+6
-4
lite/core/mir/fusion/conv_bn_fuser.cc
lite/core/mir/fusion/conv_bn_fuser.cc
+2
-2
lite/core/mir/pattern_matcher.cc
lite/core/mir/pattern_matcher.cc
+4
-2
未找到文件。
lite/core/mir/fusion/conv_bn_fuser.cc
浏览文件 @
c810ad2e
...
@@ -66,7 +66,6 @@ void ConvBNFuser::BuildPattern() {
...
@@ -66,7 +66,6 @@ void ConvBNFuser::BuildPattern() {
if
(
conv_has_bias_
)
{
if
(
conv_has_bias_
)
{
auto
*
conv_bias
=
VarNode
(
"conv_bias"
)
auto
*
conv_bias
=
VarNode
(
"conv_bias"
)
->
assert_is_op_input
(
conv_type_
,
"Bias"
)
->
assert_is_op_input
(
conv_type_
,
"Bias"
)
->
AsInput
()
->
AsIntermediate
();
->
AsIntermediate
();
conv
->
LinksFrom
({
conv_input
,
conv_weight
,
conv_bias
}).
LinksTo
({
conv_out
});
conv
->
LinksFrom
({
conv_input
,
conv_weight
,
conv_bias
}).
LinksTo
({
conv_out
});
}
else
{
}
else
{
...
@@ -172,7 +171,8 @@ void ConvBNFuser::InsertNewNode(SSAGraph* graph, const key2nodes_t& matched) {
...
@@ -172,7 +171,8 @@ void ConvBNFuser::InsertNewNode(SSAGraph* graph, const key2nodes_t& matched) {
}
}
// compute new conv_bias
// compute new conv_bias
if
(
conv_has_bias_
)
{
if
(
conv_has_bias_
&&
conv_op_desc
->
HasInput
(
"Bias"
)
&&
conv_op_desc
->
Input
(
"Bias"
).
size
()
>
0
)
{
auto
conv_bias_t
=
scope
->
FindVar
(
matched
.
at
(
"conv_bias"
)
->
arg
()
->
name
)
auto
conv_bias_t
=
scope
->
FindVar
(
matched
.
at
(
"conv_bias"
)
->
arg
()
->
name
)
->
GetMutable
<
lite
::
Tensor
>
();
->
GetMutable
<
lite
::
Tensor
>
();
auto
conv_bias_d
=
conv_bias_t
->
data
<
float
>
();
auto
conv_bias_d
=
conv_bias_t
->
data
<
float
>
();
...
...
lite/core/mir/pattern_matcher.cc
浏览文件 @
c810ad2e
...
@@ -415,7 +415,8 @@ bool IsNthOutput(const Node *var,
...
@@ -415,7 +415,8 @@ bool IsNthOutput(const Node *var,
CHECK
(
var
->
IsArg
());
CHECK
(
var
->
IsArg
());
CHECK
(
op
->
IsStmt
());
CHECK
(
op
->
IsStmt
());
auto
op_info
=
op
->
stmt
()
->
op_info
();
auto
op_info
=
op
->
stmt
()
->
op_info
();
if
(
op_info
->
Output
(
argument
).
size
()
<=
nth
)
return
false
;
if
(
!
op_info
->
HasOutput
(
argument
)
||
op_info
->
Output
(
argument
).
size
()
<=
nth
)
return
false
;
return
var
->
arg
()
->
name
==
op_info
->
Output
(
argument
)[
nth
];
return
var
->
arg
()
->
name
==
op_info
->
Output
(
argument
)[
nth
];
}
}
...
@@ -426,7 +427,8 @@ bool IsNthInput(const Node *var,
...
@@ -426,7 +427,8 @@ bool IsNthInput(const Node *var,
CHECK
(
var
->
IsArg
());
CHECK
(
var
->
IsArg
());
CHECK
(
op
->
IsStmt
());
CHECK
(
op
->
IsStmt
());
auto
op_info
=
op
->
stmt
()
->
op_info
();
auto
op_info
=
op
->
stmt
()
->
op_info
();
if
(
op_info
->
Input
(
argument
).
size
()
<=
nth
)
return
false
;
if
(
!
op_info
->
HasInput
(
argument
)
||
op_info
->
Input
(
argument
).
size
()
<=
nth
)
return
false
;
return
var
->
arg
()
->
name
==
op_info
->
Input
(
argument
)[
nth
];
return
var
->
arg
()
->
name
==
op_info
->
Input
(
argument
)[
nth
];
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录