Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
9df825b7
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看板
提交
9df825b7
编写于
6月 19, 2018
作者:
R
Ruilong Liu
提交者:
GitHub
6月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into develop
上级
3b463ea4
4da4e9c7
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
107 addition
and
52 deletion
+107
-52
CMakeLists.txt
CMakeLists.txt
+1
-1
src/common/types.cpp
src/common/types.cpp
+68
-0
src/common/types.h
src/common/types.h
+25
-46
src/framework/operator.h
src/framework/operator.h
+2
-1
src/io/io.cpp
src/io/io.cpp
+8
-1
test/net/test_googlenet.cpp
test/net/test_googlenet.cpp
+3
-3
未找到文件。
CMakeLists.txt
浏览文件 @
9df825b7
...
...
@@ -7,7 +7,7 @@ option(USE_EXCEPTION "use std exception" ON)
option
(
LOG_PROFILE
"log profile"
ON
)
# select the platform to build
option
(
CPU
"cpu"
ON
)
option
(
MALI_GPU
"mali gpu"
O
FF
)
option
(
MALI_GPU
"mali gpu"
O
N
)
option
(
FPGA
"fpga"
OFF
)
if
(
CPU
)
...
...
src/common/types.cpp
0 → 100644
浏览文件 @
9df825b7
/* 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 "common/types.h"
#include <vector>
namespace
paddle_mobile
{
const
std
::
string
G_OP_TYPE_CONV
=
"conv2d"
;
const
std
::
string
G_OP_TYPE_BATCHNORM
=
"batch_norm"
;
const
std
::
string
G_OP_TYPE_BOX_CODER
=
"box_coder"
;
const
std
::
string
G_OP_TYPE_CONCAT
=
"concat"
;
const
std
::
string
G_OP_TYPE_ELEMENTWISE_ADD
=
"elementwise_add"
;
const
std
::
string
G_OP_TYPE_FUSION_CONV_ADD_RELU
=
"fusion_conv_add_relu"
;
const
std
::
string
G_OP_TYPE_FC
=
"fc"
;
const
std
::
string
G_OP_TYPE_CONV_ADD
=
"conv_add"
;
const
std
::
string
G_OP_TYPE_LRN
=
"lrn"
;
const
std
::
string
G_OP_TYPE_MUL
=
"mul"
;
const
std
::
string
G_OP_TYPE_MULTICLASS_NMS
=
"multiclass_nms"
;
const
std
::
string
G_OP_TYPE_POOL2D
=
"pool2d"
;
const
std
::
string
G_OP_TYPE_PRIOR_BOX
=
"prior_box"
;
const
std
::
string
G_OP_TYPE_RELU
=
"relu"
;
const
std
::
string
G_OP_TYPE_RESHAPE
=
"reshape"
;
const
std
::
string
G_OP_TYPE_SIGMOID
=
"sigmoid"
;
const
std
::
string
G_OP_TYPE_SOFTMAX
=
"softmax"
;
const
std
::
string
G_OP_TYPE_TRANSPOSE
=
"transpose"
;
const
std
::
string
G_OP_TYPE_SPLIT
=
"split"
;
const
std
::
string
G_OP_TYPE_FEED
=
"feed"
;
const
std
::
string
G_OP_TYPE_FETCH
=
"fetch"
;
const
std
::
string
G_OP_TYPE_DEPTHWISE_CONV
=
"depthwise_conv2d"
;
std
::
unordered_map
<
std
::
string
,
std
::
pair
<
std
::
vector
<
std
::
string
>
,
std
::
vector
<
std
::
string
>>>
op_input_output_key
=
{
{
G_OP_TYPE_CONV
,
{{
"Input"
},
{
"Output"
}}},
{
G_OP_TYPE_CONV_ADD
,
{{
"Input"
},
{
"Out"
}}},
{
G_OP_TYPE_RELU
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_SOFTMAX
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_MUL
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_ELEMENTWISE_ADD
,
{{
"X"
,
"Y"
},
{
"Out"
}}},
{
G_OP_TYPE_POOL2D
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_BATCHNORM
,
{{
"X"
},
{
"Y"
}}},
{
G_OP_TYPE_LRN
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_CONCAT
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_SPLIT
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_FEED
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_FETCH
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_TRANSPOSE
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_BOX_CODER
,
{{
"PriorBox"
,
"PriorBoxVar"
,
"TargetBox"
},
{
"OutputBox"
}}},
{
G_OP_TYPE_PRIOR_BOX
,
{{
"Image"
,
"Input"
},
{
"Boxes"
,
"Variances"
}}},
{
G_OP_TYPE_MULTICLASS_NMS
,
{{
"BBoxes"
,
"Scores"
},
{
"Out"
}}},
{
G_OP_TYPE_FC
,
{{
"X"
,
"Y"
,
"Z"
},
{
"Out"
}}},
{
G_OP_TYPE_RESHAPE
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_DEPTHWISE_CONV
,
{{
"Input"
},
{
"Output"
}}}};
}
// namespace paddle_mobile
src/common/types.h
浏览文件 @
9df825b7
...
...
@@ -71,52 +71,31 @@ enum PMStatus {
PMWrongDevice
=
0x08
/*!< un-correct device. */
};
static
const
std
::
string
G_OP_TYPE_CONV
=
"conv2d"
;
static
const
std
::
string
G_OP_TYPE_BATCHNORM
=
"batch_norm"
;
static
const
std
::
string
G_OP_TYPE_BOX_CODER
=
"box_coder"
;
static
const
std
::
string
G_OP_TYPE_CONCAT
=
"concat"
;
static
const
std
::
string
G_OP_TYPE_ELEMENTWISE_ADD
=
"elementwise_add"
;
static
const
std
::
string
G_OP_TYPE_FUSION_CONV_ADD_RELU
=
"fusion_conv_add_relu"
;
static
const
std
::
string
G_OP_TYPE_FC
=
"fc"
;
static
const
std
::
string
G_OP_TYPE_CONV_ADD
=
"conv_add"
;
static
const
std
::
string
G_OP_TYPE_LRN
=
"lrn"
;
static
const
std
::
string
G_OP_TYPE_MUL
=
"mul"
;
static
const
std
::
string
G_OP_TYPE_MULTICLASS_NMS
=
"multiclass_nms"
;
static
const
std
::
string
G_OP_TYPE_POOL2D
=
"pool2d"
;
static
const
std
::
string
G_OP_TYPE_PRIOR_BOX
=
"prior_box"
;
static
const
std
::
string
G_OP_TYPE_RELU
=
"relu"
;
static
const
std
::
string
G_OP_TYPE_RESHAPE
=
"reshape"
;
static
const
std
::
string
G_OP_TYPE_SIGMOID
=
"sigmoid"
;
static
const
std
::
string
G_OP_TYPE_SOFTMAX
=
"softmax"
;
static
const
std
::
string
G_OP_TYPE_TRANSPOSE
=
"transpose"
;
static
const
std
::
string
G_OP_TYPE_SPLIT
=
"split"
;
static
const
std
::
string
G_OP_TYPE_FEED
=
"feed"
;
static
const
std
::
string
G_OP_TYPE_FETCH
=
"fetch"
;
static
const
std
::
string
G_OP_TYPE_DEPTHWISE_CONV
=
"depthwise_conv2d"
;
extern
const
std
::
string
G_OP_TYPE_CONV
;
extern
const
std
::
string
G_OP_TYPE_BATCHNORM
;
extern
const
std
::
string
G_OP_TYPE_BOX_CODER
;
extern
const
std
::
string
G_OP_TYPE_CONCAT
;
extern
const
std
::
string
G_OP_TYPE_ELEMENTWISE_ADD
;
extern
const
std
::
string
G_OP_TYPE_FUSION_CONV_ADD_RELU
;
extern
const
std
::
string
G_OP_TYPE_FC
;
extern
const
std
::
string
G_OP_TYPE_CONV_ADD
;
extern
const
std
::
string
G_OP_TYPE_LRN
;
extern
const
std
::
string
G_OP_TYPE_MUL
;
extern
const
std
::
string
G_OP_TYPE_MULTICLASS_NMS
;
extern
const
std
::
string
G_OP_TYPE_POOL2D
;
extern
const
std
::
string
G_OP_TYPE_PRIOR_BOX
;
extern
const
std
::
string
G_OP_TYPE_RELU
;
extern
const
std
::
string
G_OP_TYPE_RESHAPE
;
extern
const
std
::
string
G_OP_TYPE_SIGMOID
;
extern
const
std
::
string
G_OP_TYPE_SOFTMAX
;
extern
const
std
::
string
G_OP_TYPE_TRANSPOSE
;
extern
const
std
::
string
G_OP_TYPE_SPLIT
;
extern
const
std
::
string
G_OP_TYPE_FEED
;
extern
const
std
::
string
G_OP_TYPE_FETCH
;
extern
const
std
::
string
G_OP_TYPE_DEPTHWISE_CONV
;
static
std
::
unordered_map
<
extern
std
::
unordered_map
<
std
::
string
,
std
::
pair
<
std
::
vector
<
std
::
string
>
,
std
::
vector
<
std
::
string
>>>
op_input_output_key
=
{
{
G_OP_TYPE_CONV
,
{{
"Input"
},
{
"Output"
}}},
{
G_OP_TYPE_CONV_ADD
,
{{
"Input"
},
{
"Out"
}}},
{
G_OP_TYPE_RELU
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_SOFTMAX
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_MUL
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_ELEMENTWISE_ADD
,
{{
"X"
,
"Y"
},
{
"Out"
}}},
{
G_OP_TYPE_POOL2D
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_BATCHNORM
,
{{
"X"
},
{
"Y"
}}},
{
G_OP_TYPE_LRN
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_CONCAT
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_SPLIT
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_FEED
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_FETCH
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_TRANSPOSE
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_BOX_CODER
,
{{
"PriorBox"
,
"PriorBoxVar"
,
"TargetBox"
},
{
"OutputBox"
}}},
{
G_OP_TYPE_PRIOR_BOX
,
{{
"Image"
,
"Input"
},
{
"Boxes"
,
"Variances"
}}},
{
G_OP_TYPE_MULTICLASS_NMS
,
{{
"BBoxes"
,
"Scores"
},
{
"Out"
}}},
{
G_OP_TYPE_FC
,
{{
"X"
,
"Y"
,
"Z"
},
{
"Out"
}}},
{
G_OP_TYPE_RESHAPE
,
{{
"X"
},
{
"Out"
}}},
{
G_OP_TYPE_DEPTHWISE_CONV
,
{{
"Input"
},
{
"Output"
}}}};
op_input_output_key
;
}
// namespace paddle_mobile
src/framework/operator.h
浏览文件 @
9df825b7
...
...
@@ -111,7 +111,8 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
std
::
shared_ptr
<
Scope
>
scope
)
:
OperatorBase
<
Dtype
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{
kernel_
.
Init
(
param_
);
PADDLE_MOBILE_ENFORCE
(
kernel_
.
Init
(
param_
),
" %s kernel init failed"
,
this
->
type_
.
c_str
());
}
virtual
void
RunImpl
()
const
{
this
->
kernel_
.
Compute
(
this
->
param_
);
}
...
...
src/io/io.cpp
浏览文件 @
9df825b7
...
...
@@ -160,6 +160,8 @@ const framework::Program<Dtype, P> Loader<Dtype, P>::LoadProgram(
}
template
class
Loader
<
CPU
,
Precision
::
FP32
>;
template
class
Loader
<
FPGA
,
Precision
::
FP32
>;
template
class
Loader
<
GPU_MALI
,
Precision
::
FP32
>;
#pragma mark - executor
...
...
@@ -205,7 +207,10 @@ void Executor<Dtype, P>::LoadMemory(const framework::VarDesc var_desc,
data
+=
sizeof
(
uint32_t
);
// 2 Lod information
uint64_t
lod_level
=
*
(
uint64_t
*
)
data
;
uint64_t
*
lod_level_ptr
=
new
uint64_t
();
memcpy
(
lod_level_ptr
,
data
,
sizeof
(
uint64_t
));
uint64_t
lod_level
=
*
lod_level_ptr
;
delete
lod_level_ptr
;
data
+=
sizeof
(
uint64_t
);
auto
&
lod
=
*
tensor
->
mutable_lod
();
...
...
@@ -410,5 +415,7 @@ std::vector<typename Executor<Dtype, P>::Ptype> Executor<Dtype, P>::Predict(
}
template
class
Executor
<
CPU
,
Precision
::
FP32
>;
template
class
Executor
<
FPGA
,
Precision
::
FP32
>;
template
class
Executor
<
GPU_MALI
,
Precision
::
FP32
>;
}
// namespace paddle_mobile
test/net/test_googlenet.cpp
浏览文件 @
9df825b7
...
...
@@ -20,9 +20,9 @@ int main() {
paddle_mobile
::
Loader
<
paddle_mobile
::
CPU
>
loader
;
bool
optimize
=
true
;
auto
time1
=
time
();
auto
program
=
loader
.
Load
(
g_googlenet
,
optimize
);
//
auto program = loader.Load(g_googlenet_combine + "/model",
//
g_googlenet_combine + "/params", optimize);
//
auto program = loader.Load(g_googlenet, optimize);
auto
program
=
loader
.
Load
(
g_googlenet_combine
+
"/model"
,
g_googlenet_combine
+
"/params"
,
optimize
);
auto
time2
=
time
();
DLOG
<<
"load cost :"
<<
time_diff
(
time1
,
time2
)
<<
"ms
\n
"
;
paddle_mobile
::
Executor
<
paddle_mobile
::
CPU
>
executor
(
program
,
1
,
optimize
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录