Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
31f1a852
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
31f1a852
编写于
2月 14, 2020
作者:
H
huzhiqiang
提交者:
GitHub
2月 14, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[opt information]: add help information about opt and model version (#2881)
上级
2a68646c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
3 deletion
+28
-3
lite/api/opt.cc
lite/api/opt.cc
+4
-1
lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc
lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc
+3
-0
lite/model_parser/model_parser.cc
lite/model_parser/model_parser.cc
+21
-2
未找到文件。
lite/api/opt.cc
浏览文件 @
31f1a852
...
...
@@ -26,6 +26,7 @@
#include "lite/api/paddle_use_ops.h"
#include "lite/api/paddle_use_passes.h"
#include "lite/core/op_registry.h"
#include "lite/core/version.h"
#include "lite/model_parser/compatible_pb.h"
#include "lite/model_parser/pb/program_desc.h"
#include "lite/utils/cp_logging.h"
...
...
@@ -239,6 +240,7 @@ void PrintOpsInfo(std::set<std::string> valid_ops = {}) {
/// Print help information
void
PrintHelpInfo
()
{
// at least one argument should be inputed
const
std
::
string
opt_version
=
lite
::
version
();
const
char
help_info
[]
=
"At least one argument should be inputed. Valid arguments are listed "
"below:
\n
"
...
...
@@ -260,7 +262,8 @@ void PrintHelpInfo() {
" `--print_model_ops=true --model_dir=<model_param_dir> "
"--valid_targets=(arm|opencl|x86|npu|xpu)`"
" Display operators in the input model
\n
"
;
std
::
cout
<<
help_info
<<
std
::
endl
;
std
::
cout
<<
"opt version:"
<<
opt_version
<<
std
::
endl
<<
help_info
<<
std
::
endl
;
exit
(
1
);
}
...
...
lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc
浏览文件 @
31f1a852
...
...
@@ -28,6 +28,9 @@ void RunModel(std::string model_dir) {
// 1. Set MobileConfig
MobileConfig
config
;
config
.
set_model_dir
(
model_dir
);
// To load model transformed by opt after release/v2.3.0, plese use
// `set_model_from_file` listed below.
// config.set_model_from_file(model_dir);
// 2. Create PaddlePredictor by MobileConfig
std
::
shared_ptr
<
PaddlePredictor
>
predictor
=
...
...
lite/model_parser/model_parser.cc
浏览文件 @
31f1a852
...
...
@@ -696,6 +696,13 @@ void LoadModelNaive(const std::string &model_dir,
CHECK
(
scope
);
cpp_prog
->
ClearBlocks
();
LOG
(
WARNING
)
<<
"WARNING: MobileConfig::set_model_dir and "
"MobileConfig::set_model_buffer are deprecated APIs "
"and will be removed in latter release.
\n
"
" MobileConfig::set_model_from_file(const std::string& model_file)"
" and MobileConfig::set_model_from_buffer(const std::string& "
"model_buffer) are recommended."
;
// Load model
const
std
::
string
prog_path
=
model_dir
+
"/__model__.nb"
;
naive_buffer
::
BinaryTable
table
;
...
...
@@ -786,11 +793,23 @@ void LoadModelNaiveFromFile(const std::string &filename,
// (2)get opt version
char
opt_version
[
16
];
const
uint64_t
paddle
_version_length
=
16
*
sizeof
(
char
);
const
uint64_t
opt
_version_length
=
16
*
sizeof
(
char
);
ReadModelDataFromFile
<
char
>
(
opt_version
,
prog_path
,
&
offset
,
paddle
_version_length
);
opt_version
,
prog_path
,
&
offset
,
opt
_version_length
);
VLOG
(
4
)
<<
"Opt_version:"
<<
opt_version
;
// check version, opt's version should be consistent with current Paddle-Lite
// version.
const
std
::
string
paddle_version
=
version
();
const
std
::
string
opt_version_str
=
opt_version
;
if
(
paddle_version
==
opt_version_str
)
{
LOG
(
WARNING
)
<<
"warning: the version of opt that transformed this model "
"is not consistent with current Paddle-Lite version."
"
\n
version of opt:"
<<
opt_version
<<
"
\n
version of current Paddle-Lite:"
<<
paddle_version
;
}
// (3)get topo_size
uint64_t
topo_size
;
ReadModelDataFromFile
<
uint64_t
>
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录