Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冰之2023
Mace
提交
903f399d
Mace
项目概览
冰之2023
/
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,体验更适合开发者的 AI 搜索 >>
提交
903f399d
编写于
12月 01, 2017
作者:
李
李寅
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature_wuch' into 'master'
fix dsp op test See merge request !133
上级
627fcfb3
20a6681f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
20 deletion
+25
-20
mace/dsp/test/quantized_resize_bilinear_test.cc
mace/dsp/test/quantized_resize_bilinear_test.cc
+24
-19
mace/dsp/test/supernode_test.cc
mace/dsp/test/supernode_test.cc
+1
-1
未找到文件。
mace/dsp/test/quantized_resize_bilinear_test.cc
浏览文件 @
903f399d
...
...
@@ -5,6 +5,7 @@
#include "mace/dsp/hexagon_control_wrapper.h"
#include "gtest/gtest.h"
#define RESIZE_BILINEAR_TEST_CHANNELS 128
using
namespace
mace
;
static
NetDef
BuildNetDef
()
{
...
...
@@ -17,7 +18,7 @@ static NetDef BuildNetDef() {
input_op
->
set_type
(
"INPUT"
);
input_op
->
set_node_id
(
0
);
input_op
->
set_padding
(
0
);
input_op
->
add_out_max_byte_size
(
1
0
00
);
input_op
->
add_out_max_byte_size
(
1
2
00
);
// relu op
OperatorDef
*
resize_bilinear_op
=
net
.
add_op
();
...
...
@@ -45,7 +46,7 @@ static NetDef BuildNetDef() {
input_node_input
=
resize_bilinear_op
->
add_node_input
();
input_node_input
->
set_node_id
(
12
);
input_node_input
->
set_output_port
(
0
);
resize_bilinear_op
->
add_out_max_byte_size
(
1
0
00
);
resize_bilinear_op
->
add_out_max_byte_size
(
1
2
00
);
resize_bilinear_op
->
add_out_max_byte_size
(
1000
);
resize_bilinear_op
->
add_out_max_byte_size
(
1000
);
...
...
@@ -64,8 +65,8 @@ static NetDef BuildNetDef() {
new_dim_tensor
->
add_dims
(
2
);
new_dim_tensor
->
set_data_type
(
DataType
::
DT_INT32
);
new_dim_tensor
->
set_node_id
(
10
);
new_dim_tensor
->
add_int32_data
(
1
);
new_dim_tensor
->
add_int32_data
(
1
);
new_dim_tensor
->
add_int32_data
(
2
);
new_dim_tensor
->
add_int32_data
(
2
);
TensorProto
*
input_min_tensor
=
net
.
add_tensors
();
input_min_tensor
->
set_name
(
"input_min"
);
...
...
@@ -86,20 +87,20 @@ static NetDef BuildNetDef() {
input_info
->
set_name
(
"input_node"
);
input_info
->
set_node_id
(
0
);
input_info
->
add_dims
(
1
);
input_info
->
add_dims
(
2
);
input_info
->
add_dims
(
2
);
input_info
->
add_dims
(
128
);
input_info
->
add_dims
(
3
);
input_info
->
add_dims
(
3
);
input_info
->
add_dims
(
RESIZE_BILINEAR_TEST_CHANNELS
);
input_info
->
set_data_type
(
DataType
::
DT_UINT8
);
input_info
->
set_max_byte_size
(
1
0
00
);
input_info
->
set_max_byte_size
(
1
2
00
);
OutputInfo
*
output_info
=
net
.
add_output_info
();
output_info
->
set_name
(
"output_node"
);
output_info
->
set_node_id
(
1
);
output_info
->
add_dims
(
1
);
output_info
->
add_dims
(
1
);
output_info
->
add_dims
(
1
);
output_info
->
add_dims
(
128
);
output_info
->
add_dims
(
2
);
output_info
->
add_dims
(
2
);
output_info
->
add_dims
(
RESIZE_BILINEAR_TEST_CHANNELS
);
output_info
->
set_data_type
(
DataType
::
DT_UINT8
);
output_info
->
set_max_byte_size
(
1
0
00
);
output_info
->
set_max_byte_size
(
1
2
00
);
return
net
;
}
...
...
@@ -117,21 +118,25 @@ TEST(QuantizedResizeBilinearTest, QuantizedResizeBilinear) {
Allocator
*
cpu_allocator
=
GetDeviceAllocator
(
DeviceType
::
CPU
);
Tensor
input_tensor
(
cpu_allocator
,
DT_UINT8
);
Tensor
output_tensor
(
cpu_allocator
,
DT_UINT8
);
input_tensor
.
Resize
({
1
,
2
,
2
,
128
});
output_tensor
.
Resize
({
1
,
1
,
1
,
128
});
input_tensor
.
Resize
({
1
,
3
,
3
,
RESIZE_BILINEAR_TEST_CHANNELS
});
output_tensor
.
Resize
({
1
,
2
,
2
,
RESIZE_BILINEAR_TEST_CHANNELS
});
uint8_t
*
input_data
=
input_tensor
.
mutable_data
<
uint8_t
>
();
const
uint8_t
*
output_data
=
output_tensor
.
data
<
uint8_t
>
();
for
(
int
c
=
0
;
c
<
128
;
++
c
)
{
input_data
[
c
]
=
input_data
[
c
+
128
]
=
input_data
[
c
+
256
]
=
input_data
[
c
+
384
]
=
(
uint8_t
)
c
;
for
(
int
wh
=
0
;
wh
<
9
;
++
wh
)
{
for
(
int
c
=
0
;
c
<
RESIZE_BILINEAR_TEST_CHANNELS
;
++
c
)
{
input_data
[
wh
*
RESIZE_BILINEAR_TEST_CHANNELS
+
c
]
=
9
-
wh
;
}
}
VLOG
(
0
)
<<
wrapper
.
ExecuteGraph
(
input_tensor
,
&
output_tensor
);
wrapper
.
PrintLog
();
for
(
int
i
=
0
;
i
<
output_tensor
.
size
();
++
i
)
{
EXPECT_EQ
(
i
,
output_data
[
i
]);
vector
<
uint8_t
>
expected
{
9
,
8
,
5
,
3
};
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
c
=
0
;
c
<
RESIZE_BILINEAR_TEST_CHANNELS
;
++
c
)
EXPECT_EQ
(
expected
[
i
],
output_data
[
i
*
RESIZE_BILINEAR_TEST_CHANNELS
+
c
]);
}
std
::
cout
<<
std
::
endl
;
...
...
mace/dsp/test/supernode_test.cc
浏览文件 @
903f399d
...
...
@@ -224,7 +224,7 @@ TEST(SupernodeTest, Supernode) {
input_data
[
h
*
4
+
w
]
=
(
uint8_t
)((
h
==
0
)
?
0
:
h
*
64
-
1
);
}
VLOG
(
0
)
<<
wrapper
.
ExecuteGraph
New
(
&
input_tensor
,
1
,
&
output_tensor
,
1
);
VLOG
(
0
)
<<
wrapper
.
ExecuteGraph
(
input_tensor
,
&
output_tensor
);
wrapper
.
PrintLog
();
// expect out: [[49.2095, 49.2095], [50.7905, 50.7905]]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录