Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
项目经理老王
Mace
提交
b48db643
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,发现更多精彩内容 >>
提交
b48db643
编写于
12月 09, 2019
作者:
叶
叶剑武
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix running on host
fix py code format
上级
0f37ee96
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
10 deletion
+18
-10
tools/python/py_proto/__init__.py
tools/python/py_proto/__init__.py
+11
-6
tools/python/run_model.py
tools/python/run_model.py
+1
-1
tools/python/run_target.py
tools/python/run_target.py
+1
-1
tools/python/utils/device.py
tools/python/utils/device.py
+5
-2
未找到文件。
tools/python/py_proto/__init__.py
浏览文件 @
b48db643
...
@@ -24,11 +24,16 @@ cwd = os.path.dirname(__file__)
...
@@ -24,11 +24,16 @@ cwd = os.path.dirname(__file__)
# TODO: Remove bazel deps
# TODO: Remove bazel deps
try
:
try
:
device
.
execute
(
"bazel build //mace/proto:mace_py"
)
device
.
execute
(
"bazel version"
)
device
.
execute
(
"cp -f bazel-genfiles/mace/proto/mace_pb2.py %s"
%
cwd
)
device
.
execute
(
"bazel build //third_party/caffe:caffe_py"
)
device
.
execute
(
"cp -f bazel-genfiles/third_party/caffe/caffe_pb2.py %s"
%
cwd
)
except
:
# noqa
except
:
# noqa
MaceLogger
.
warning
(
"No bazel, use cmake."
)
MaceLogger
.
warning
(
"No bazel, use cmake."
)
else
:
try
:
device
.
execute
(
"bazel build //mace/proto:mace_py"
)
device
.
execute
(
"cp -f bazel-genfiles/mace/proto/mace_pb2.py %s"
%
cwd
)
device
.
execute
(
"bazel build //third_party/caffe:caffe_py"
)
device
.
execute
(
"cp -f bazel-genfiles/third_party/caffe/caffe_pb2.py %s"
%
cwd
)
except
:
# noqa
MaceLogger
.
error
(
"Failed in proto files' building"
)
tools/python/run_model.py
浏览文件 @
b48db643
...
@@ -73,7 +73,7 @@ def run_models(flags, args):
...
@@ -73,7 +73,7 @@ def run_models(flags, args):
MaceLogger
.
info
(
"Run on devices: %s"
%
run_devices
)
MaceLogger
.
info
(
"Run on devices: %s"
%
run_devices
)
for
device_id
in
run_devices
:
for
device_id
in
run_devices
:
dev
=
device
.
crete_device
(
flags
.
target_abi
,
device_id
)
dev
=
device
.
cre
a
te_device
(
flags
.
target_abi
,
device_id
)
run_models_for_device
(
flags
,
args
,
dev
)
run_models_for_device
(
flags
,
args
,
dev
)
...
...
tools/python/run_target.py
浏览文件 @
b48db643
...
@@ -44,7 +44,7 @@ def run_target(target_abi, install_dir, target_obj, device_ids="all"):
...
@@ -44,7 +44,7 @@ def run_target(target_abi, install_dir, target_obj, device_ids="all"):
for
device_id
in
run_devices
:
for
device_id
in
run_devices
:
# initiate device
# initiate device
dev
=
device
.
crete_device
(
target_abi
,
device_id
)
dev
=
device
.
cre
a
te_device
(
target_abi
,
device_id
)
# reinstall target
# reinstall target
print
(
"Install target from %s to %s"
%
(
target_obj
.
path
,
install_dir
))
print
(
"Install target from %s to %s"
%
(
target_obj
.
path
,
install_dir
))
...
...
tools/python/utils/device.py
浏览文件 @
b48db643
...
@@ -94,7 +94,10 @@ class HostDevice(Device):
...
@@ -94,7 +94,10 @@ class HostDevice(Device):
if
install_dir
.
strip
()
and
install_dir
!=
os
.
path
.
dirname
(
target
.
path
):
if
install_dir
.
strip
()
and
install_dir
!=
os
.
path
.
dirname
(
target
.
path
):
execute
(
"mkdir -p %s"
%
install_dir
)
execute
(
"mkdir -p %s"
%
install_dir
)
execute
(
"cp %s %s"
%
(
target
.
path
,
install_dir
))
if
os
.
path
.
isdir
(
target
.
path
):
execute
(
"cp %s/* %s"
%
(
target
.
path
,
install_dir
))
else
:
execute
(
"cp %s %s"
%
(
target
.
path
,
install_dir
))
for
lib
in
target
.
libs
:
for
lib
in
target
.
libs
:
execute
(
"cp %s %s"
%
(
lib
,
install_dir
))
execute
(
"cp %s %s"
%
(
lib
,
install_dir
))
...
@@ -285,7 +288,7 @@ def device_class(target_abi):
...
@@ -285,7 +288,7 @@ def device_class(target_abi):
return
globals
()[
device_dispatch
[
target_abi
]]
return
globals
()[
device_dispatch
[
target_abi
]]
def
crete_device
(
target_abi
,
device_id
=
None
):
def
cre
a
te_device
(
target_abi
,
device_id
=
None
):
return
device_class
(
target_abi
)(
device_id
,
target_abi
)
return
device_class
(
target_abi
)(
device_id
,
target_abi
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录