Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
b8831606
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看板
提交
b8831606
编写于
5月 27, 2018
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format files
上级
30d22c55
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
4104 addition
and
4589 deletion
+4104
-4589
src/common/protobuf-c.c
src/common/protobuf-c.c
+2005
-2355
src/common/protobuf-c.h
src/common/protobuf-c.h
+327
-365
src/common/type_define.h
src/common/type_define.h
+1
-1
src/framework/attribute.h
src/framework/attribute.h
+3
-3
src/framework/framework.pb-c.c
src/framework/framework.pb-c.c
+1331
-1471
src/framework/framework.pb-c.h
src/framework/framework.pb-c.h
+322
-283
src/framework/program/block_desc.cpp
src/framework/program/block_desc.cpp
+4
-3
src/framework/program/block_desc.h
src/framework/program/block_desc.h
+1
-1
src/framework/program/program_desc.cpp
src/framework/program/program_desc.cpp
+1
-2
src/framework/program/tensor_desc.cpp
src/framework/program/tensor_desc.cpp
+14
-0
src/framework/program/tensor_desc.h
src/framework/program/tensor_desc.h
+25
-29
src/framework/program/var_desc.cpp
src/framework/program/var_desc.cpp
+1
-4
src/framework/program/var_desc.h
src/framework/program/var_desc.h
+33
-40
src/io.cpp
src/io.cpp
+30
-27
src/io.h
src/io.h
+5
-2
src/platform/data_type.h
src/platform/data_type.h
+1
-2
test/executor_for_test.h
test/executor_for_test.h
+0
-1
未找到文件。
src/common/protobuf-c.c
浏览文件 @
b8831606
此差异已折叠。
点击以展开。
src/common/protobuf-c.h
100755 → 100644
浏览文件 @
b8831606
此差异已折叠。
点击以展开。
src/common/type_define.h
浏览文件 @
b8831606
...
...
@@ -16,8 +16,8 @@ limitations under the License. */
#include <map>
#include <string>
#include <vector>
#include <unordered_set>
#include <vector>
#include "framework/attribute.h"
#include "framework/scope.h"
...
...
src/framework/attribute.h
浏览文件 @
b8831606
...
...
@@ -15,8 +15,8 @@ limitations under the License. */
#pragma once
#include <unordered_map>
#include "common/log.h"
#include "common/enforce.h"
#include "common/log.h"
#include "common/variant.h"
#include "framework/framework.pb-c.h"
...
...
@@ -27,7 +27,6 @@ class BlockDesc;
class
Attribute
{
public:
/*
* PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INT = 0,
PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOAT = 1,
...
...
@@ -42,7 +41,8 @@ class Attribute {
PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE)
*
* */
static
Attribute
GetAttrValue
(
PaddleMobile__Framework__Proto__OpDesc__Attr
*
attr_desc
)
{
static
Attribute
GetAttrValue
(
PaddleMobile__Framework__Proto__OpDesc__Attr
*
attr_desc
)
{
// std::cout << "begin get attr value" << std::endl;
Attribute
attr
;
switch
(
attr_desc
->
type
)
{
...
...
src/framework/framework.pb-c.c
浏览文件 @
b8831606
此差异已折叠。
点击以展开。
src/framework/framework.pb-c.h
浏览文件 @
b8831606
此差异已折叠。
点击以展开。
src/framework/program/block_desc.cpp
浏览文件 @
b8831606
...
...
@@ -33,17 +33,18 @@ std::vector<std::shared_ptr<OpDesc>> BlockDesc::Ops() const {
return
res
;
}
BlockDesc
::
BlockDesc
(
PaddleMobile__Framework__Proto__BlockDesc
*
desc
)
:
index_
(
desc
->
idx
),
parent_index_
(
desc
->
idx
)
{
BlockDesc
::
BlockDesc
(
PaddleMobile__Framework__Proto__BlockDesc
*
desc
)
:
index_
(
desc
->
idx
),
parent_index_
(
desc
->
idx
)
{
for
(
int
i
=
0
;
i
<
desc
->
n_vars
;
++
i
)
{
PaddleMobile__Framework__Proto__VarDesc
*
var_desc
=
desc
->
vars
[
i
];
vars_
[
std
::
string
(
var_desc
->
name
)]
=
std
::
shared_ptr
<
VarDesc
>
(
new
VarDesc
(
var_desc
));
vars_
[
std
::
string
(
var_desc
->
name
)]
=
std
::
shared_ptr
<
VarDesc
>
(
new
VarDesc
(
var_desc
));
}
for
(
int
j
=
0
;
j
<
desc
->
n_ops
;
++
j
)
{
PaddleMobile__Framework__Proto__OpDesc
*
op_desc
=
desc
->
ops
[
j
];
ops_
.
emplace_back
(
new
framework
::
OpDesc
(
op_desc
));
}
}
}
// namespace framework
...
...
src/framework/program/block_desc.h
浏览文件 @
b8831606
...
...
@@ -15,9 +15,9 @@ limitations under the License. */
#pragma once
#include "framework/framework.pb-c.h"
#include "framework/paddle_mobile_object.h"
#include "framework/program/op_desc.h"
#include "framework/program/var_desc.h"
#include "framework/paddle_mobile_object.h"
namespace
paddle_mobile
{
namespace
framework
{
...
...
src/framework/program/program_desc.cpp
浏览文件 @
b8831606
...
...
@@ -15,8 +15,8 @@ limitations under the License. */
#include <string>
#include <vector>
#include "program_desc.h"
#include "framework/program/tensor_desc.h"
#include "program_desc.h"
namespace
paddle_mobile
{
namespace
framework
{
...
...
@@ -70,7 +70,6 @@ void ProgramDesc::Description(std::string header) {
}
}
}
}
#endif
}
...
...
src/framework/program/tensor_desc.cpp
浏览文件 @
b8831606
/* 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. */
//
// Created by liuRuiLong on 2018/5/26.
//
...
...
src/framework/program/tensor_desc.h
浏览文件 @
b8831606
...
...
@@ -21,26 +21,26 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
framework
{
enum
VarType_Type
{
VARTYPE_TYPE_BOOL
=
0
,
VARTYPE_TYPE_INT16
=
1
,
VARTYPE_TYPE_INT32
=
2
,
VARTYPE_TYPE_INT64
=
3
,
VARTYPE_TYPE_FP16
=
4
,
VARTYPE_TYPE_FP32
=
5
,
VARTYPE_TYPE_FP64
=
6
,
VARTYPE_TYPE_LOD_TENSOR
=
7
,
VARTYPE_TYPE_SELECTED_ROWS
=
8
,
VARTYPE_TYPE_FEED_MINIBATCH
=
9
,
VARTYPE_TYPE_FETCH_LIST
=
10
,
VARTYPE_TYPE_STEP_SCOPES
=
11
,
VARTYPE_TYPE_STEP_LOD_RANK_TABLE
=
12
,
VARTYPE_TYPE_STEP_LOD_TENSOR_ARRAY
=
13
,
VARTYPE_TYPE_STEP_PLACE_LIST
=
14
,
VARTYPE_TYPE_READER
=
15
,
VARTYPE_TYPE_CHANNEL
=
16
,
VARTYPE_TYPE_RAW
=
17
,
VARTYPE_TYPE_TUPLE
=
18
enum
VarType_Type
{
VARTYPE_TYPE_BOOL
=
0
,
VARTYPE_TYPE_INT16
=
1
,
VARTYPE_TYPE_INT32
=
2
,
VARTYPE_TYPE_INT64
=
3
,
VARTYPE_TYPE_FP16
=
4
,
VARTYPE_TYPE_FP32
=
5
,
VARTYPE_TYPE_FP64
=
6
,
VARTYPE_TYPE_LOD_TENSOR
=
7
,
VARTYPE_TYPE_SELECTED_ROWS
=
8
,
VARTYPE_TYPE_FEED_MINIBATCH
=
9
,
VARTYPE_TYPE_FETCH_LIST
=
10
,
VARTYPE_TYPE_STEP_SCOPES
=
11
,
VARTYPE_TYPE_STEP_LOD_RANK_TABLE
=
12
,
VARTYPE_TYPE_STEP_LOD_TENSOR_ARRAY
=
13
,
VARTYPE_TYPE_STEP_PLACE_LIST
=
14
,
VARTYPE_TYPE_READER
=
15
,
VARTYPE_TYPE_CHANNEL
=
16
,
VARTYPE_TYPE_RAW
=
17
,
VARTYPE_TYPE_TUPLE
=
18
};
class
TensorDesc
{
...
...
@@ -59,17 +59,13 @@ class TensorDesc {
data_type_
=
(
VarType_Type
)
desc
->
data_type
;
}
std
::
vector
<
int64_t
>
Dims
()
const
{
return
dims_
;
};
VarType_Type
DataType
()
const
{
return
data_type_
;
}
std
::
vector
<
int64_t
>
Dims
()
const
{
return
dims_
;
};
VarType_Type
DataType
()
const
{
return
data_type_
;
}
private:
std
::
vector
<
int64_t
>
dims_
;
VarType_Type
data_type_
;
};
}
}
}
// namespace framework
}
// namespace paddle_mobile
src/framework/program/var_desc.cpp
浏览文件 @
b8831606
...
...
@@ -16,8 +16,5 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
framework
{
}
// namespace framework
namespace
framework
{}
// namespace framework
}
// namespace paddle_mobile
src/framework/program/var_desc.h
浏览文件 @
b8831606
此差异已折叠。
点击以展开。
src/io.cpp
浏览文件 @
b8831606
此差异已折叠。
点击以展开。
src/io.h
浏览文件 @
b8831606
...
...
@@ -33,7 +33,9 @@ class Loader : PaddleMobileObject {
const
framework
::
Program
<
Dtype
,
P
>
Load
(
const
std
::
string
&
dirname
);
private:
void
LoadVar
(
framework
::
Variable
*
variable
,
const
framework
::
VarDesc
&
var_desc
,
const
std
::
string
&
file_path
);
void
LoadVar
(
framework
::
Variable
*
variable
,
const
framework
::
VarDesc
&
var_desc
,
const
std
::
string
&
file_path
);
};
template
<
typename
Dtype
,
Precision
P
=
Precision
::
FP32
>
...
...
@@ -52,7 +54,8 @@ class Executor {
protected:
void
InitMemory
();
void
LoadMemory
(
const
framework
::
VarDesc
var_desc
,
framework
::
LoDTensor
*
tensor
,
const
std
::
string
&
file_path
);
void
LoadMemory
(
const
framework
::
VarDesc
var_desc
,
framework
::
LoDTensor
*
tensor
,
const
std
::
string
&
file_path
);
framework
::
Program
<
Dtype
>
program_
;
std
::
shared_ptr
<
framework
::
ProgramDesc
>
to_predict_program_
;
void
predict
(
const
framework
::
Tensor
&
t
,
int
block_id
);
...
...
src/platform/data_type.h
浏览文件 @
b8831606
...
...
@@ -116,8 +116,7 @@ inline std::string DataTypeToString(const VarType_Type type) {
}
}
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
VarType_Type
&
type
)
{
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
VarType_Type
&
type
)
{
out
<<
DataTypeToString
(
type
);
return
out
;
}
...
...
test/executor_for_test.h
浏览文件 @
b8831606
...
...
@@ -58,7 +58,6 @@ class Executor4Test : public Executor<DeviceType> {
for
(
std
::
shared_ptr
<
BlockDesc
>
block_desc
:
blocks
)
{
std
::
vector
<
std
::
shared_ptr
<
OpDesc
>>
ops
=
block_desc
->
Ops
();
for
(
std
::
shared_ptr
<
OpDesc
>
op
:
ops
)
{
if
(
op
->
Type
()
==
op_type
)
{
/// test first meeting op in program
std
::
shared_ptr
<
paddle_mobile
::
framework
::
OperatorBase
<
DeviceType
>>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录