Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
d39fc79c
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
337
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看板
提交
d39fc79c
编写于
6月 28, 2018
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add support for mul fusion changes
上级
c9ddb454
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
15 deletion
+24
-15
CMakeLists.txt
CMakeLists.txt
+1
-1
src/framework/program/program-optimize/node.cpp
src/framework/program/program-optimize/node.cpp
+8
-5
src/framework/program/program-optimize/node.h
src/framework/program/program-optimize/node.h
+2
-2
src/operators/fusion_conv_add.h
src/operators/fusion_conv_add.h
+3
-1
src/operators/fusion_conv_add_relu_op.h
src/operators/fusion_conv_add_relu_op.h
+4
-4
src/operators/fusion_fc_op.h
src/operators/fusion_fc_op.h
+5
-1
test/framework/test_load.cpp
test/framework/test_load.cpp
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
d39fc79c
...
...
@@ -6,7 +6,7 @@ option(USE_OPENMP "openmp support" OFF)
option
(
USE_EXCEPTION
"use std exception"
ON
)
option
(
LOG_PROFILE
"log profile"
ON
)
# select the platform to build
option
(
CPU
"cpu"
O
FF
)
option
(
CPU
"cpu"
O
N
)
option
(
MALI_GPU
"mali gpu"
ON
)
option
(
FPGA
"fpga"
OFF
)
...
...
src/framework/program/program-optimize/node.cpp
浏览文件 @
d39fc79c
...
...
@@ -92,7 +92,7 @@ int Node::Depth(int begin) {
Node
&
Node
::
Folder
(
int
size
,
std
::
string
type
,
std
::
map
<
std
::
string
,
std
::
pair
<
std
::
string
,
std
::
string
>>
change
,
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>>
change
,
std
::
vector
<
std
::
shared_ptr
<
Node
>>
*
removed_nodes
)
{
std
::
shared_ptr
<
framework
::
OpDesc
>
op_desc
=
std
::
make_shared
<
framework
::
OpDesc
>
();
...
...
@@ -109,12 +109,15 @@ Node &Node::Folder(
void
Node
::
Folder
(
std
::
shared_ptr
<
framework
::
OpDesc
>
op_desc
,
std
::
vector
<
std
::
shared_ptr
<
Node
>>
*
outputs
,
int
index
,
std
::
map
<
std
::
string
,
std
::
pair
<
std
::
string
,
std
::
string
>>
*
change
,
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>>
*
change
,
Node
*
begin_node
,
std
::
vector
<
std
::
shared_ptr
<
Node
>>
*
removed_nodes
)
{
if
(
change
->
find
(
this
->
type_
)
!=
change
->
end
())
{
auto
change_pair
=
(
*
change
)[
this
->
type_
];
op_desc
->
GetInputs
()[
change_pair
.
second
]
=
this
->
op_desc_
->
GetInputs
()[
change_pair
.
first
];
auto
change_pairs
=
(
*
change
)[
this
->
type_
];
for
(
const
auto
&
change_pair
:
change_pairs
)
{
op_desc
->
GetInputs
()[
change_pair
.
second
]
=
this
->
op_desc_
->
GetInputs
()[
change_pair
.
first
];
}
}
for
(
auto
&
attr_pair
:
this
->
op_desc_
->
attrs_
)
{
...
...
src/framework/program/program-optimize/node.h
浏览文件 @
d39fc79c
...
...
@@ -43,7 +43,7 @@ class Node {
int
Depth
(
int
begin
=
0
);
Node
&
Folder
(
int
size
,
std
::
string
type
,
std
::
map
<
std
::
string
,
std
::
pair
<
std
::
string
,
std
::
string
>>
change_map
,
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>>
change
,
std
::
vector
<
std
::
shared_ptr
<
Node
>>
*
removed_nodes
);
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
OpDescs
(
int
size
);
std
::
shared_ptr
<
framework
::
OpDesc
>
OpDescOfNode
()
{
return
op_desc_
;
}
...
...
@@ -56,7 +56,7 @@ class Node {
void
Folder
(
std
::
shared_ptr
<
framework
::
OpDesc
>
op_desc
,
std
::
vector
<
std
::
shared_ptr
<
Node
>>
*
outputs
,
int
index
,
std
::
map
<
std
::
string
,
std
::
pair
<
std
::
string
,
std
::
string
>>
*
change
,
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>
>>
*
change
,
Node
*
begin_node
,
std
::
vector
<
std
::
shared_ptr
<
Node
>>
*
removed_nodes
);
std
::
shared_ptr
<
framework
::
OpDesc
>
op_desc_
;
#ifdef PADDLE_MOBILE_DEBUG
...
...
src/operators/fusion_conv_add.h
浏览文件 @
d39fc79c
...
...
@@ -40,7 +40,7 @@ class FusionConvAddMatcher : public framework::FusionOpMatcher {
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
origin_descs
=
node
->
OpDescs
(
node_
.
Depth
());
node
->
Folder
(
node_
.
Depth
(),
Type
(),
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{
"Y"
,
"Y"
}}},
removed_nodes
);
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{
{
"Y"
,
"Y"
}
}}},
removed_nodes
);
}
std
::
string
Type
()
{
return
G_OP_TYPE_CONV_ADD
;
}
...
...
@@ -68,11 +68,13 @@ class FusionConvAddOp : public framework::OperatorWithKernel<
};
#ifdef PADDLE_MOBILE_CPU
#ifndef CONV_ADD_REGISTER
static
framework
::
FusionOpRegistrar
convadd_registrar
(
new
FusionConvAddMatcher
());
#define CONV_ADD_REGISTER
#endif
#endif
#ifdef PADDLE_MOBILE_MALI_GPU
...
...
src/operators/fusion_conv_add_relu_op.h
浏览文件 @
d39fc79c
...
...
@@ -36,7 +36,7 @@ class FusionConvAddReluOpMatcher : public framework::FusionOpMatcher {
framework
::
Node
*
node
,
std
::
vector
<
std
::
shared_ptr
<
framework
::
Node
>>
*
removed_nodes
)
{
node
->
Folder
(
node_
.
Depth
(),
Type
(),
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{
"Y"
,
"Y"
}}},
removed_nodes
);
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{
{
"Y"
,
"Y"
}
}}},
removed_nodes
);
}
std
::
string
Type
()
{
return
G_OP_TYPE_FUSION_CONV_ADD_RELU
;
}
};
...
...
@@ -65,11 +65,11 @@ class FusionConvAddReluOp : public framework::OperatorWithKernel<
#ifdef PADDLE_MOBILE_CPU
#ifndef CONV_ADD_RELU_REGISTER
#define CONV_ADD_RELU_REGISTER
//
#ifndef CONV_ADD_RELU_REGISTER
//
#define CONV_ADD_RELU_REGISTER
// static framework::FusionOpRegistrar fusion_conv_add_relu_registrar(new
// FusionConvAddReluOpMatcher());
#endif
//
#endif
#endif
#ifdef PADDLE_MOBILE_MALI_GPU
...
...
src/operators/fusion_fc_op.h
浏览文件 @
d39fc79c
...
...
@@ -38,7 +38,7 @@ class FusionFcMatcher : public framework::FusionOpMatcher {
framework
::
Node
*
node
,
std
::
vector
<
std
::
shared_ptr
<
framework
::
Node
>>
*
removed_nodes
)
{
node
->
Folder
(
node_
.
Depth
(),
Type
(),
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{
"Y"
,
"Z"
}}},
removed_nodes
);
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{
{
"Y"
,
"Z"
}
}}},
removed_nodes
);
}
std
::
string
Type
()
{
return
G_OP_TYPE_FC
;
}
...
...
@@ -66,17 +66,21 @@ class FusionFcOp
};
#ifdef PADDLE_MOBILE_CPU
#ifndef CONV_CPU_REGISTER
#define CONV_CPU_REGISTER
static
framework
::
FusionOpRegistrar
fc_registrar
(
new
FusionFcMatcher
());
#endif
#endif
#ifdef PADDLE_MOBILE_MALI_GPU
#ifndef CONV_CPU_REGISTER
#define CONV_CPU_REGISTER
static
framework
::
FusionOpRegistrar
fc_registrar
(
new
FusionFcMatcher
());
#endif
#endif
#ifdef PADDLE_MOBILE_FPGA
...
...
test/framework/test_load.cpp
浏览文件 @
d39fc79c
...
...
@@ -19,7 +19,7 @@ int main() {
paddle_mobile
::
Loader
<
paddle_mobile
::
CPU
>
loader
;
// ../../../test/models/googlenet
// ../../../test/models/mobilenet
auto
program
=
loader
.
Load
(
g_
mobilenet_ssd
,
false
,
fals
e
);
auto
program
=
loader
.
Load
(
g_
googlenet
,
tru
e
);
// auto program = loader.Load(g_googlenet_combine + "/model",
// g_googlenet_combine +
// "/params", true);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录