Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
毕竟曾有刹那
Mace
提交
adace180
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,发现更多精彩内容 >>
提交
adace180
编写于
11月 25, 2019
作者:
卢
卢旭辉
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'update' into 'master'
Update for HTA See merge request !1230
上级
4926f268
fc1dd4f6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
51 deletion
+43
-51
docs/user_guide/advanced_usage.rst
docs/user_guide/advanced_usage.rst
+9
-6
docs/user_guide/advanced_usage_cmake.rst
docs/user_guide/advanced_usage_cmake.rst
+9
-6
mace/core/runtime/hexagon/hexagon_hta_ops.h
mace/core/runtime/hexagon/hexagon_hta_ops.h
+2
-2
mace/core/runtime/hexagon/hexagon_hta_wrapper.cc
mace/core/runtime/hexagon/hexagon_hta_wrapper.cc
+20
-37
mace/libmace/mace.cc
mace/libmace/mace.cc
+3
-0
未找到文件。
docs/user_guide/advanced_usage.rst
浏览文件 @
adace180
...
...
@@ -308,19 +308,22 @@ Transform models after conversion
// Report error or fallback
}
std::vector<unsigned char> transformed_model_graph_data;
std::vector<unsigned char> transformed_model_weights_data;
// Add transformations here.
...
// Release original model data after transformations
model_graph_data.reset();
model_weights_data.reset();
// Create the MACE engine from the model buffer
std::shared_ptr<mace::MaceEngine> engine;
MaceStatus create_engine_status;
create_engine_status =
CreateMaceEngineFromProto(reinterpret_cast<const unsigned char *>(
model_graph_data->data()),
model_graph_data->length(),
reinterpret_cast<const unsigned char *>(
model_weights_data->data()),
model_weights_data->length(),
CreateMaceEngineFromProto(transformed_model_graph_data.data(),
transformed_model_graph_data.size(),
transformed_model_weights_data.data(),
transformed_model_weights_data.size(),
input_names,
output_names,
config,
...
...
docs/user_guide/advanced_usage_cmake.rst
浏览文件 @
adace180
...
...
@@ -260,19 +260,22 @@ and ``model_data_format`` are set as `file`.
//
Report
error
or
fallback
}
std
::
vector
<
unsigned
char
>
transformed_model_graph_data
;
std
::
vector
<
unsigned
char
>
transformed_model_weights_data
;
//
Add
transformations
here
.
...
//
Release
original
model
data
after
transformations
model_graph_data
.
reset
();
model_weights_data
.
reset
();
//
Create
the
MACE
engine
from
the
model
buffer
std
::
shared_ptr
<
mace
::
MaceEngine
>
engine
;
MaceStatus
create_engine_status
;
create_engine_status
=
CreateMaceEngineFromProto
(
reinterpret_cast
<
const
unsigned
char
*>(
model_graph_data
->
data
()),
model_graph_data
->
length
(),
reinterpret_cast
<
const
unsigned
char
*>(
model_weights_data
->
data
()),
model_weights_data
->
length
(),
CreateMaceEngineFromProto
(
transformed_model_graph_data
.
data
(),
transformed_model_graph_data
.
size
(),
transformed_model_weights_data
.
data
(),
transformed_model_weights_data
.
size
(),
input_names
,
output_names
,
config
,
...
...
mace/core/runtime/hexagon/hexagon_hta_ops.h
浏览文件 @
adace180
...
...
@@ -26,11 +26,11 @@ namespace mace {
class
OpMap
{
public:
void
Init
()
{
#define
HTA_
DEF_OP(NAME) op_map_[#NAME] = HTA_OP_##NAME;
#define DEF_OP(NAME) op_map_[#NAME] = HTA_OP_##NAME;
#include "third_party/hta/hta_ops.h"
#undef
HTA_
DEF_OP
#undef DEF_OP
}
hta_op_type
GetOpId
(
const
std
::
string
&
op_type
)
{
...
...
mace/core/runtime/hexagon/hexagon_hta_wrapper.cc
浏览文件 @
adace180
...
...
@@ -73,32 +73,24 @@ bool HexagonHTAWrapper::SetupGraph(const NetDef &net_def,
tensor_shape
.
insert
(
tensor_shape
.
begin
(),
1
);
}
hexagon_nn_const_node
const_node
;
const_node
.
node_id
=
node_id
(
const_tensor
.
node_id
());
const_node
.
tensor
.
batches
=
tensor_shape
[
0
];
const_node
.
tensor
.
height
=
tensor_shape
[
1
];
const_node
.
tensor
.
width
=
tensor_shape
[
2
];
const_node
.
tensor
.
depth
=
tensor_shape
[
3
];
if
(
const_tensor
.
data_type
()
==
DataType
::
DT_INT32
&&
const_tensor
.
data_size
()
==
0
)
{
const_node
.
tensor
.
data
=
NULL
;
const_node
.
tensor
.
dataLen
=
0
;
}
else
{
const_node
.
tensor
.
data
=
unsigned
char
*
const_node_data
=
nullptr
;
int
const_node_data_len
=
0
;
if
(
!
(
const_tensor
.
data_type
()
==
DataType
::
DT_INT32
&&
const_tensor
.
data_size
()
==
0
))
{
const_node_data
=
const_cast
<
unsigned
char
*>
(
model_data
+
const_tensor
.
offset
());
const_node
.
tensor
.
dataL
en
=
const_tensor
.
data_size
()
*
const_node
_data_l
en
=
const_tensor
.
data_size
()
*
GetEnumTypeSize
(
const_tensor
.
data_type
());
}
hexagon_hta_nn_append_const_node
(
nn_id_
,
const_node
.
node_id
,
const_node
.
tensor
.
batches
,
const_node
.
tensor
.
height
,
const_node
.
tensor
.
width
,
const_node
.
tensor
.
depth
,
const_node
.
tensor
.
data
,
const_node
.
tensor
.
dataL
en
);
node_id
(
const_tensor
.
node_id
())
,
tensor_shape
[
0
]
,
tensor_shape
[
1
]
,
tensor_shape
[
2
]
,
tensor_shape
[
3
]
,
const_node
_
data
,
const_node
_data_l
en
);
}
// op node
...
...
@@ -137,23 +129,14 @@ bool HexagonHTAWrapper::SetupGraph(const NetDef &net_def,
auto
padding_type
=
static_cast
<
hta_padding_type
>
(
op
.
padding
());
hexagon_nn_op_node
op_node
;
op_node
.
node_id
=
node_id
(
op
.
node_id
());
op_node
.
operation
=
op_id
;
op_node
.
padding
=
padding_type
;
op_node
.
inputs
=
cached_inputs
.
back
().
data
();
op_node
.
inputsLen
=
inputs
.
size
();
op_node
.
outputs
=
cached_outputs
.
back
().
data
();
op_node
.
outputsLen
=
outputs
.
size
();
hexagon_hta_nn_append_node
(
nn_id_
,
op_node
.
node_id
,
op_
node
.
operation
,
op_node
.
padding
,
op_node
.
inputs
,
op_node
.
inputsLen
,
op_node
.
outputs
,
o
p_node
.
outputsLen
);
node_id
(
op
.
node_id
())
,
op_
id
,
padding_type
,
cached_inputs
.
back
().
data
()
,
inputs
.
size
()
,
cached_outputs
.
back
().
data
()
,
o
utputs
.
size
()
);
}
// input info
...
...
mace/libmace/mace.cc
浏览文件 @
adace180
...
...
@@ -600,6 +600,9 @@ MaceStatus MaceEngine::Impl::Init(
#if defined(MACE_ENABLE_HEXAGON) || defined(MACE_ENABLE_HTA)
if
(
device_type_
==
HEXAGON
||
device_type_
==
HTA
)
{
hexagon_controller_
=
CreateHexagonControlWrapper
(
device_
.
get
());
LOG
(
INFO
)
<<
"Hexagon "
<<
(
device_type_
==
HEXAGON
?
"DSP"
:
"HTA"
)
<<
" version: 0x"
<<
std
::
hex
<<
hexagon_controller_
->
GetVersion
();
MACE_CHECK
(
hexagon_controller_
->
Config
(),
"hexagon config error"
);
MACE_CHECK
(
hexagon_controller_
->
Init
(),
"hexagon init error"
);
hexagon_controller_
->
SetDebugLevel
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录