Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
cdf5d030
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
cdf5d030
编写于
3月 18, 2019
作者:
叶
叶剑武
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'capability' into 'master'
Feature: Add capability information for mace_run See merge request !1001
上级
0894c8e9
36703e80
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
28 addition
and
48 deletion
+28
-48
mace/libmace/mace_version_script.lds
mace/libmace/mace_version_script.lds
+1
-0
mace/public/mace.h
mace/public/mace.h
+1
-1
mace/python/tools/converter_tool/tensorflow_converter.py
mace/python/tools/converter_tool/tensorflow_converter.py
+12
-37
mace/tools/validation/mace_run.cc
mace/tools/validation/mace_run.cc
+14
-10
未找到文件。
mace/libmace/mace_version_script.lds
浏览文件 @
cdf5d030
...
...
@@ -7,6 +7,7 @@ mace {
*CreateMaceEngineFromProto*;
*GetBigLittleCoreIDs*;
*MaceVersion*;
*GetCapability*;
# api for static library of models
*mace*logging*LogMessage*;
...
...
mace/public/mace.h
浏览文件 @
cdf5d030
...
...
@@ -102,7 +102,7 @@ class RunMetadata {
/// Consistent with Android NNAPI
struct
PerformanceInfo
{
// Time of executing some workload.
// Time of executing some workload
(millisecond)
.
// negative value for unsupported.
float
exec_time
;
};
...
...
mace/python/tools/converter_tool/tensorflow_converter.py
浏览文件 @
cdf5d030
...
...
@@ -123,8 +123,7 @@ TFOpType = Enum('TFOpType', [(op, op) for op in TFSupportedOps], type=str)
TFSupportedOps
=
[
six
.
b
(
op
)
for
op
in
TFSupportedOps
]
TFTransformGraphOptions
=
{
base_converter
.
DeviceType
.
CPU
.
value
:
[
TFTransformGraphOptions
=
[
'strip_unused_nodes'
,
'remove_nodes(op=Identity, op=CheckNumerics)'
,
'fold_constants(ignore_errors=true)'
,
...
...
@@ -133,29 +132,7 @@ TFTransformGraphOptions = {
'remove_control_dependencies'
,
'strip_unused_nodes'
,
'sort_by_execution_order'
],
base_converter
.
DeviceType
.
GPU
.
value
:
[
'strip_unused_nodes'
,
'remove_nodes(op=Identity, op=CheckNumerics)'
,
'fold_constants(ignore_errors=true)'
,
'flatten_atrous_conv'
,
'fold_batch_norms'
,
'fold_old_batch_norms'
,
'remove_control_dependencies'
,
'strip_unused_nodes'
,
'sort_by_execution_order'
],
base_converter
.
DeviceType
.
HEXAGON
.
value
:
[
'strip_unused_nodes'
,
'remove_nodes(op=Identity, op=CheckNumerics)'
,
'fold_constants(ignore_errors=true)'
,
'fold_batch_norms'
,
'fold_old_batch_norms'
,
'remove_control_dependencies'
,
'strip_unused_nodes'
,
'sort_by_execution_order'
]
}
]
class
TensorflowConverter
(
base_converter
.
ConverterInterface
):
...
...
@@ -289,15 +266,13 @@ class TensorflowConverter(base_converter.ConverterInterface):
self
.
_placeholders
=
{}
print
(
"Run transform_graph: %s"
%
TFTransformGraphOptions
[
option
.
device
])
print
(
"Run transform_graph: %s"
%
TFTransformGraphOptions
)
try
:
print
(
"output keys: "
,
option
.
output_nodes
.
keys
())
transformed_graph_def
=
TransformGraph
(
tf_graph_def
,
option
.
input_nodes
.
keys
(),
option
.
output_nodes
.
keys
(),
TFTransformGraphOptions
[
option
.
device
])
TFTransformGraphOptions
)
except
Exception
as
ex
:
print
(
"Failed to transform graph using tf tool: %s"
%
ex
)
transformed_graph_def
=
tf_graph_def
...
...
mace/tools/validation/mace_run.cc
浏览文件 @
cdf5d030
...
...
@@ -225,7 +225,8 @@ bool RunModel(const std::string &model_name,
const
std
::
vector
<
DataFormat
>
&
input_data_formats
,
const
std
::
vector
<
std
::
string
>
&
output_names
,
const
std
::
vector
<
std
::
vector
<
int64_t
>>
&
output_shapes
,
const
std
::
vector
<
DataFormat
>
&
output_data_formats
)
{
const
std
::
vector
<
DataFormat
>
&
output_data_formats
,
float
cpu_capability
)
{
DeviceType
device_type
=
ParseDeviceType
(
FLAGS_device
);
int64_t
t0
=
NowMicros
();
...
...
@@ -446,11 +447,11 @@ bool RunModel(const std::string &model_name,
}
// Metrics reporting tools depends on the format, keep in consistent
printf
(
"========================================
\n
"
);
printf
(
" init warmup run_avg
\n
"
);
printf
(
"========================================
\n
"
);
printf
(
"time %11.3f %11.3f %11.3f
\n
"
,
init_millis
,
warmup_millis
,
model_run_millis
);
printf
(
"========================================
================
\n
"
);
printf
(
"
capability(CPU)
init warmup run_avg
\n
"
);
printf
(
"========================================
================
\n
"
);
printf
(
"time %1
5.3f %1
1.3f %11.3f %11.3f
\n
"
,
cpu_capability
,
init_millis
,
warmup_millis
,
model_run_millis
);
for
(
size_t
i
=
0
;
i
<
output_count
;
++
i
)
{
...
...
@@ -532,13 +533,16 @@ int Main(int argc, char **argv) {
}
// get cpu capability
Capability
cpu_capability
=
GetCapability
(
DeviceType
::
CPU
);
bool
ret
=
false
;
for
(
int
i
=
0
;
i
<
FLAGS_restart_round
;
++
i
)
{
VLOG
(
0
)
<<
"restart round "
<<
i
;
ret
=
RunModel
(
FLAGS_model_name
,
ret
=
RunModel
(
FLAGS_model_name
,
input_names
,
input_shape_vec
,
input_data_formats
,
output_names
,
output_shape_vec
,
output_data_formats
);
output_names
,
output_shape_vec
,
output_data_formats
,
cpu_capability
.
float32_performance
.
exec_time
);
}
if
(
ret
)
{
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录