Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
87cb0880
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,发现更多精彩内容 >>
提交
87cb0880
编写于
4月 23, 2018
作者:
Y
yejianwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use 'with open(...) as f' in python
上级
92686bae
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
19 addition
and
23 deletion
+19
-23
mace/python/tools/binary_codegen.py
mace/python/tools/binary_codegen.py
+2
-3
mace/python/tools/encrypt_opencl_codegen.py
mace/python/tools/encrypt_opencl_codegen.py
+13
-14
mace/python/tools/opencl_codegen.py
mace/python/tools/opencl_codegen.py
+2
-3
mace/python/tools/source_converter_lib.py
mace/python/tools/source_converter_lib.py
+2
-3
未找到文件。
mace/python/tools/binary_codegen.py
浏览文件 @
87cb0880
...
...
@@ -74,9 +74,8 @@ def tuning_param_codegen(binary_dirs,
binary_dirs
,
binary_file_name
,
variable_name
)
if
os
.
path
.
isfile
(
output_path
):
os
.
remove
(
output_path
)
w
_file
=
open
(
output_path
,
"w"
)
w
ith
open
(
output_path
,
"w"
)
as
w_file
:
w_file
.
write
(
cpp_binary_source
)
w_file
.
close
()
def
parse_args
():
...
...
mace/python/tools/encrypt_opencl_codegen.py
浏览文件 @
87cb0880
...
...
@@ -44,14 +44,14 @@ def encrypt_opencl_codegen(cl_kernel_dir, output_path):
for
file_name
in
os
.
listdir
(
cl_kernel_dir
):
file_path
=
os
.
path
.
join
(
cl_kernel_dir
,
file_name
)
if
file_path
[
-
2
:]
==
".h"
:
f
=
open
(
file_path
,
"r"
)
with
open
(
file_path
,
"r"
)
as
f
:
header_code
+=
f
.
read
()
encrypted_code_maps
=
{}
for
file_name
in
os
.
listdir
(
cl_kernel_dir
):
file_path
=
os
.
path
.
join
(
cl_kernel_dir
,
file_name
)
if
file_path
[
-
3
:]
==
".cl"
:
f
=
open
(
file_path
,
"r"
)
with
open
(
file_path
,
"r"
)
as
f
:
code_str
=
""
for
line
in
f
.
readlines
():
if
"#include <common.h>"
in
line
:
...
...
@@ -70,9 +70,8 @@ def encrypt_opencl_codegen(cl_kernel_dir, output_path):
if
os
.
path
.
isfile
(
output_path
):
os
.
remove
(
output_path
)
w
_file
=
open
(
output_path
,
"w"
)
w
ith
open
(
output_path
,
"w"
)
as
w_file
:
w_file
.
write
(
cpp_cl_encrypted_kernel
)
w_file
.
close
()
print
(
"Generate encrypted opencl source done!"
)
...
...
mace/python/tools/opencl_codegen.py
浏览文件 @
87cb0880
...
...
@@ -86,9 +86,8 @@ def opencl_codegen(output_path,
platform_info_file_name
)
if
os
.
path
.
isfile
(
output_path
):
os
.
remove
(
output_path
)
w
_file
=
open
(
output_path
,
"w"
)
w
ith
open
(
output_path
,
"w"
)
as
w_file
:
w_file
.
write
(
cpp_cl_binary_source
)
w_file
.
close
()
def
parse_args
():
...
...
mace/python/tools/source_converter_lib.py
浏览文件 @
87cb0880
...
...
@@ -173,9 +173,8 @@ def convert_to_source(net_def, mode_pb_checksum, template_dir, obfuscate,
with
open
(
output_dir
+
'tensor_data'
+
'.cc'
,
"wb"
)
as
f
:
f
.
write
(
source
)
if
not
embed_model_data
:
f
=
open
(
output_dir
+
model_tag
+
'.data'
,
"wb"
)
with
open
(
output_dir
+
model_tag
+
'.data'
,
"wb"
)
as
f
:
f
.
write
(
bytearray
(
model_data
))
f
.
close
()
# generate op source files
template_name
=
'operator.jinja2'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录