Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mr.Vain
Mace
提交
32ffb40f
Mace
项目概览
Mr.Vain
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
1
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,发现更多精彩内容 >>
提交
32ffb40f
编写于
4月 26, 2018
作者:
L
Liangliang He
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add introspective build info
上级
d3ccb99b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
3 deletion
+41
-3
mace/examples/example.cc
mace/examples/example.cc
+6
-0
mace/python/tools/converter.py
mace/python/tools/converter.py
+1
-1
mace/python/tools/model.jinja2
mace/python/tools/model.jinja2
+13
-0
mace/python/tools/model_header.jinja2
mace/python/tools/model_header.jinja2
+6
-0
mace/python/tools/source_converter_lib.py
mace/python/tools/source_converter_lib.py
+9
-2
mace/tools/validation/mace_run.cc
mace/tools/validation/mace_run.cc
+6
-0
未找到文件。
mace/examples/example.cc
浏览文件 @
32ffb40f
...
...
@@ -47,7 +47,10 @@ extern void UnloadModelData(const unsigned char *model_data);
extern
NetDef
CreateNet
(
const
unsigned
char
*
model_data
);
extern
const
std
::
string
ModelName
();
extern
const
std
::
string
ModelChecksum
();
extern
const
std
::
string
ModelBuildTime
();
extern
const
std
::
string
ModelBuildOptions
();
}
// namespace MACE_MODEL_TAG
}
// namespace mace
...
...
@@ -246,7 +249,10 @@ int Main(int argc, char **argv) {
gflags
::
ParseCommandLineFlags
(
&
argc
,
&
argv
,
true
);
LOG
(
INFO
)
<<
"mace version: "
<<
MaceVersion
();
LOG
(
INFO
)
<<
"model name: "
<<
mace
::
MACE_MODEL_TAG
::
ModelName
();
LOG
(
INFO
)
<<
"model checksum: "
<<
mace
::
MACE_MODEL_TAG
::
ModelChecksum
();
LOG
(
INFO
)
<<
"build time: "
<<
mace
::
MACE_MODEL_TAG
::
ModelBuildTime
();
LOG
(
INFO
)
<<
"build options: "
<<
mace
::
MACE_MODEL_TAG
::
ModelBuildOptions
();
LOG
(
INFO
)
<<
"input node: "
<<
FLAGS_input_node
;
LOG
(
INFO
)
<<
"input shape: "
<<
FLAGS_input_shape
;
LOG
(
INFO
)
<<
"output node: "
<<
FLAGS_output_node
;
...
...
mace/python/tools/converter.py
浏览文件 @
32ffb40f
...
...
@@ -84,7 +84,7 @@ def main(unused_args):
source_converter_lib
.
convert_to_source
(
output_graph_def
,
model_checksum
,
FLAGS
.
template
,
FLAGS
.
obfuscate
,
FLAGS
.
model_tag
,
FLAGS
.
output
,
FLAGS
.
runtime
,
FLAGS
.
embed_model_data
)
FLAGS
.
embed_model_data
,
FLAGS
.
winograd
)
else
:
with
open
(
FLAGS
.
output
,
"wb"
)
as
f
:
f
.
write
(
output_graph_def
.
SerializeToString
())
...
...
mace/python/tools/model.jinja2
浏览文件 @
32ffb40f
...
...
@@ -154,9 +154,22 @@ NetDef CreateNet(const unsigned char *model_data) {
return net_def;
}
const std::string ModelName() {
return {{ tag|tojson }};
}
const std::string ModelChecksum() {
return {{ model_pb_checksum|tojson }};
}
const std::string ModelBuildTime() {
return {{ build_time|tojson }};
}
const std::string ModelBuildOptions() {
return {{ "runtime: {}, obfuscate: {}, embed_model_data: {}, winograd: {}"
.format(runtime, obfuscate, embed_model_data, winograd_conv)|tojson }};
}
} // namespace {{tag}}
} // namespace mace
mace/python/tools/model_header.jinja2
浏览文件 @
32ffb40f
...
...
@@ -30,8 +30,14 @@ void UnloadModelData(const unsigned char *model_data);
NetDef CreateNet(const unsigned char *model_data);
const std::string ModelName();
const std::string ModelChecksum();
const std::string ModelBuildTime();
const std::string ModelBuildOptions();
} // namespace {{ tag }}
} // namespace mace
...
...
mace/python/tools/source_converter_lib.py
浏览文件 @
32ffb40f
...
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
datetime
import
os
import
uuid
import
numpy
as
np
...
...
@@ -124,7 +125,8 @@ def stringfy(value):
def
convert_to_source
(
net_def
,
mode_pb_checksum
,
template_dir
,
obfuscate
,
model_tag
,
output
,
runtime
,
embed_model_data
):
model_tag
,
output
,
runtime
,
embed_model_data
,
winograd_conv
):
if
obfuscate
:
obfuscate_name
(
net_def
)
else
:
...
...
@@ -193,6 +195,7 @@ def convert_to_source(net_def, mode_pb_checksum, template_dir, obfuscate,
counter
+=
1
# generate model source files
build_time
=
datetime
.
datetime
.
now
().
strftime
(
'%Y-%m-%d %H:%M:%S'
)
template_name
=
'model.jinja2'
tensors
=
[
TensorInfo
(
i
,
net_def
.
tensors
[
i
],
runtime
)
...
...
@@ -203,7 +206,11 @@ def convert_to_source(net_def, mode_pb_checksum, template_dir, obfuscate,
net
=
net_def
,
tag
=
model_tag
,
runtime
=
runtime
,
model_pb_checksum
=
mode_pb_checksum
)
obfuscate
=
obfuscate
,
embed_model_data
=
embed_model_data
,
winograd_conv
=
winograd_conv
,
model_pb_checksum
=
mode_pb_checksum
,
build_time
=
build_time
)
with
open
(
output
,
"wb"
)
as
f
:
f
.
write
(
source
)
...
...
mace/tools/validation/mace_run.cc
浏览文件 @
32ffb40f
...
...
@@ -52,7 +52,10 @@ extern void UnloadModelData(const unsigned char *model_data);
extern
NetDef
CreateNet
(
const
unsigned
char
*
model_data
);
extern
const
std
::
string
ModelName
();
extern
const
std
::
string
ModelChecksum
();
extern
const
std
::
string
ModelBuildTime
();
extern
const
std
::
string
ModelBuildOptions
();
}
// namespace MACE_MODEL_TAG
}
// namespace mace
...
...
@@ -355,7 +358,10 @@ int Main(int argc, char **argv) {
gflags
::
ParseCommandLineFlags
(
&
argc
,
&
argv
,
true
);
LOG
(
INFO
)
<<
"mace version: "
<<
MaceVersion
();
LOG
(
INFO
)
<<
"model name: "
<<
mace
::
MACE_MODEL_TAG
::
ModelName
();
LOG
(
INFO
)
<<
"model checksum: "
<<
mace
::
MACE_MODEL_TAG
::
ModelChecksum
();
LOG
(
INFO
)
<<
"build time: "
<<
mace
::
MACE_MODEL_TAG
::
ModelBuildTime
();
LOG
(
INFO
)
<<
"build options: "
<<
mace
::
MACE_MODEL_TAG
::
ModelBuildOptions
();
LOG
(
INFO
)
<<
"input node: "
<<
FLAGS_input_node
;
LOG
(
INFO
)
<<
"input shape: "
<<
FLAGS_input_shape
;
LOG
(
INFO
)
<<
"output node: "
<<
FLAGS_output_node
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录