Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
b6b51e36
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,发现更多精彩内容 >>
提交
b6b51e36
编写于
3月 13, 2019
作者:
Y
yejianwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix python3 support for hexagon, update docs for docker image
上级
3e795fa3
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
13 addition
and
11 deletion
+13
-11
docs/installation/using_docker.rst
docs/installation/using_docker.rst
+4
-4
mace/python/tools/converter_tool/hexagon_converter.py
mace/python/tools/converter_tool/hexagon_converter.py
+6
-4
mace/python/tools/quantization/quantize_util.py
mace/python/tools/quantization/quantize_util.py
+3
-3
未找到文件。
docs/installation/using_docker.rst
浏览文件 @
b6b51e36
...
...
@@ -15,18 +15,18 @@ In most cases, the ``lite edition`` image can satisfy developer's basic needs.
.. code:: sh
#
Pull lite edition docker image
#
You can pull lite edition docker image from docker repo (recommended)
docker pull registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev-lite
#
Build lite edition docker image
#
Or build lite edition docker image by yourself
docker build -t registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev-lite ./docker/mace-dev-lite
- ``full edition`` docker image (which contains multiple NDK versions and other dev tools).
.. code:: sh
#
Pull full edition docker image
#
You can pull full edition docker image from docker repo (recommended)
docker pull registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev
#
Build full edition docker image
#
Or build full edition docker image by yourself
docker build -t registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev ./docker/mace-dev
.. note::
...
...
mace/python/tools/converter_tool/hexagon_converter.py
浏览文件 @
b6b51e36
...
...
@@ -29,6 +29,8 @@ from mace.python.tools.converter_tool.base_converter import ReduceType
from
mace.python.tools.convert_util
import
mace_check
from
mace.python.tools
import
graph_util
from
six.moves
import
reduce
HexagonSupportedOps
=
[
'BatchToSpaceND_8'
,
...
...
@@ -126,9 +128,9 @@ class HexagonConverter(base_converter.ConverterInterface):
self
.
add_input_output_node
()
if
not
self
.
_option
.
check_nodes
:
output_name
=
self
.
_option
.
output_nodes
.
values
(
)[
0
].
name
output_name
=
list
(
self
.
_option
.
output_nodes
.
values
()
)[
0
].
name
else
:
output_name
=
self
.
_option
.
check_nodes
.
values
(
)[
0
].
name
output_name
=
list
(
self
.
_option
.
check_nodes
.
values
()
)[
0
].
name
output_name
=
normalize_name
(
output_name
)
self
.
_model
=
graph_util
.
sort_mace_graph
(
self
.
_model
,
output_name
)
...
...
@@ -388,9 +390,9 @@ class HexagonConverter(base_converter.ConverterInterface):
output_node
=
None
if
not
self
.
_option
.
check_nodes
:
output_name
=
self
.
_option
.
output_nodes
.
values
(
)[
0
].
name
output_name
=
list
(
self
.
_option
.
output_nodes
.
values
()
)[
0
].
name
else
:
output_name
=
self
.
_option
.
check_nodes
.
values
(
)[
0
].
name
output_name
=
list
(
self
.
_option
.
check_nodes
.
values
()
)[
0
].
name
output_name
=
normalize_name
(
output_name
)
for
op
in
self
.
_model
.
op
:
if
op
.
name
==
output_name
:
...
...
mace/python/tools/quantization/quantize_util.py
浏览文件 @
b6b51e36
...
...
@@ -100,7 +100,7 @@ def cal_multiplier_and_shift(scale):
def
quantize_with_scale_and_zero
(
data
,
scale
,
zero
):
output
=
np
.
round
(
zero
+
data
/
scale
).
astype
(
int
)
output
=
np
.
round
(
zero
+
data
/
scale
).
astype
(
np
.
int32
)
quantized_data
=
QuantizedData
()
quantized_data
.
data
=
output
quantized_data
.
scale
=
scale
...
...
@@ -114,7 +114,7 @@ def quantize(data, non_zero):
in_max
=
np_data
.
max
()
scale
,
zero
,
out_min
,
out_max
=
adjust_range
(
in_min
,
in_max
,
non_zero
=
non_zero
)
output
=
np
.
clip
((
np
.
round
(
zero
+
data
/
scale
).
astype
(
int
)),
0
,
255
)
output
=
np
.
clip
((
np
.
round
(
zero
+
data
/
scale
).
astype
(
np
.
int32
)),
0
,
255
)
quantized_data
=
QuantizedData
()
quantized_data
.
data
=
output
...
...
@@ -132,7 +132,7 @@ def quantize_bias_for_hexagon(data):
in_max
=
max_val
scale
=
(
in_max
-
in_min
)
/
2
**
32
zero
=
0
output
=
np
.
clip
((
np
.
round
(
zero
+
data
/
scale
).
astype
(
long
)),
output
=
np
.
clip
((
np
.
round
(
zero
+
data
/
scale
).
astype
(
np
.
int64
)),
-
2
**
31
,
2
**
31
-
1
)
quantized_data
=
QuantizedData
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录