Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
毕竟曾有刹那
Mace
提交
2b04dbe9
Mace
项目概览
毕竟曾有刹那
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2b04dbe9
编写于
9月 27, 2019
作者:
B
Bin Li
提交者:
叶剑武
10月 28, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor mace_run
上级
d83cab22
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
45 addition
and
52 deletion
+45
-52
docs/user_guide/quantization_usage.rst
docs/user_guide/quantization_usage.rst
+1
-1
mace/tools/mace_run.cc
mace/tools/mace_run.cc
+44
-51
未找到文件。
docs/user_guide/quantization_usage.rst
浏览文件 @
2b04dbe9
...
...
@@ -62,7 +62,7 @@ MACE provides tools to do statistics with following steps:
.. code:: sh
python tools/python/
tools/
quantize/quantize_stat.py --log_file range_log > overall_range
python tools/python/quantize/quantize_stat.py --log_file range_log > overall_range
4. Convert quantized model (by setting `target_abis` to the final target abis, e.g., `armeabi-v7a`,
...
...
mace/tools/mace_run.cc
浏览文件 @
2b04dbe9
...
...
@@ -318,7 +318,8 @@ bool RunModel(const std::string &model_name,
DIR
*
dir_parent
;
struct
dirent
*
entry
;
dir_parent
=
opendir
(
FLAGS_input_dir
.
c_str
());
if
(
dir_parent
)
{
MACE_CHECK
(
dir_parent
!=
nullptr
,
"Open input_dir "
,
FLAGS_input_dir
,
" failed: "
,
strerror
(
errno
));
while
((
entry
=
readdir
(
dir_parent
)))
{
std
::
string
file_name
=
std
::
string
(
entry
->
d_name
);
std
::
string
prefix
=
FormatName
(
input_names
[
0
]);
...
...
@@ -329,16 +330,13 @@ bool RunModel(const std::string &model_name,
file_name
=
FLAGS_input_dir
+
"/"
+
FormatName
(
input_names
[
i
])
+
suffix
;
std
::
ifstream
in_file
(
file_name
,
std
::
ios
::
in
|
std
::
ios
::
binary
);
std
::
cout
<<
"Read "
<<
file_name
<<
std
::
endl
;
if
(
in_file
.
is_open
())
{
LOG
(
INFO
)
<<
"Read "
<<
file_name
;
MACE_CHECK
(
in_file
.
is_open
(),
"Open input file failed: "
,
strerror
(
errno
));
in_file
.
read
(
reinterpret_cast
<
char
*>
(
inputs
[
input_names
[
i
]].
data
().
get
()),
inputs_size
[
input_names
[
i
]]
*
sizeof
(
float
));
in_file
.
close
();
}
else
{
std
::
cerr
<<
"Open input file failed"
<<
std
::
endl
;
return
-
1
;
}
}
engine
->
Run
(
inputs
,
&
outputs
);
...
...
@@ -347,7 +345,8 @@ bool RunModel(const std::string &model_name,
std
::
string
output_name
=
FLAGS_output_dir
+
"/"
+
FormatName
(
output_names
[
i
])
+
suffix
;
std
::
ofstream
out_file
(
output_name
,
std
::
ios
::
binary
);
if
(
out_file
.
is_open
())
{
MACE_CHECK
(
out_file
.
is_open
(),
"Open output file failed: "
,
strerror
(
errno
));
int64_t
output_size
=
std
::
accumulate
(
output_shapes
[
i
].
begin
(),
output_shapes
[
i
].
end
(),
...
...
@@ -359,20 +358,12 @@ bool RunModel(const std::string &model_name,
output_size
*
sizeof
(
float
));
out_file
.
flush
();
out_file
.
close
();
}
else
{
std
::
cerr
<<
"Open output file failed"
<<
std
::
endl
;
return
-
1
;
}
}
}
}
}
closedir
(
dir_parent
);
}
else
{
std
::
cerr
<<
"Directory "
<<
FLAGS_input_dir
<<
" does not exist."
<<
std
::
endl
;
}
}
else
{
LOG
(
INFO
)
<<
"Warm up run"
;
double
warmup_millis
;
...
...
@@ -539,6 +530,8 @@ int Main(int argc, char **argv) {
LOG
(
INFO
)
<<
"output shape: "
<<
FLAGS_output_shape
;
LOG
(
INFO
)
<<
"input_file: "
<<
FLAGS_input_file
;
LOG
(
INFO
)
<<
"output_file: "
<<
FLAGS_output_file
;
LOG
(
INFO
)
<<
"input dir: "
<<
FLAGS_input_dir
;
LOG
(
INFO
)
<<
"output dir: "
<<
FLAGS_output_dir
;
LOG
(
INFO
)
<<
"model_data_file: "
<<
FLAGS_model_data_file
;
LOG
(
INFO
)
<<
"model_file: "
<<
FLAGS_model_file
;
LOG
(
INFO
)
<<
"device: "
<<
FLAGS_device
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录