Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
0559b0a6
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0559b0a6
编写于
5月 07, 2020
作者:
C
chenjiaoAngel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix gemm ut bug
上级
2562652a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
25 deletion
+23
-25
lite/backends/arm/math/gemm_prepacked_int8.cc
lite/backends/arm/math/gemm_prepacked_int8.cc
+6
-6
lite/tests/math/conv_compute_test.cc
lite/tests/math/conv_compute_test.cc
+5
-0
lite/tests/math/conv_int8_compute_test.cc
lite/tests/math/conv_int8_compute_test.cc
+9
-16
lite/tests/utils/naive_math_impl.h
lite/tests/utils/naive_math_impl.h
+3
-3
未找到文件。
lite/backends/arm/math/gemm_prepacked_int8.cc
浏览文件 @
0559b0a6
...
...
@@ -487,7 +487,7 @@ inline void gemm_int8_kernel(const int8_t* a_ptr,
"cmp %w[is_relu], #0\n"
/* skip relu */
\
"beq 9f \n"
/* no act end */
\
"cmp %w[is_relu], #1\n"
/* skip relu */
\
"b
eq
10f \n"
/* other act */
\
"b
ne
10f \n"
/* other act */
\
"movi v0.4s, #0\n"
/* for relu */
\
"fmax v16.4s, v16.4s, v0.4s\n"
/* relu */
\
"fmax v17.4s, v17.4s, v0.4s\n"
/* relu */
\
...
...
@@ -511,7 +511,7 @@ inline void gemm_int8_kernel(const int8_t* a_ptr,
/* do relu6 */
\
"10: \n" \
"cmp %w[is_relu], #2 \n"
/* check relu6 */
\
"b
eq
11f \n"
/* no act end */
\
"b
ne
11f \n"
/* no act end */
\
"movi v0.4s, #0\n"
/* for relu6 */
\
"fmax v16.4s, v16.4s, v0.4s\n"
/* relu */
\
"fmax v17.4s, v17.4s, v0.4s\n"
/* relu */
\
...
...
@@ -1211,7 +1211,7 @@ inline void gemm_sdot_int8_kernel(const int8_t* a_ptr,
"cmp %w[relu], #0\n"
/* skip relu */
\
"beq 12f\n" \
"cmp %w[relu], #1\n"
/* skip relu */
\
"b
eq
13f\n"
/* other act */
\
"b
ne
13f\n"
/* other act */
\
"movi v2.4s, #0\n"
/* for relu*/
\
"fmax v8.4s, v8.4s, v2.4s\n"
/* relu*/
\
"fmax v9.4s, v9.4s, v2.4s\n"
/* relu*/
\
...
...
@@ -1242,7 +1242,7 @@ inline void gemm_sdot_int8_kernel(const int8_t* a_ptr,
#define GEMM_SDOT_RELU6 \
"13: \n" \
"cmp %w[relu], #2\n"
/* skip relu6 */
\
"b
eq
14f\n" \
"b
ne
14f\n" \
"movi v2.4s, #0\n"
/* for relu*/
\
"fmax v8.4s, v8.4s, v2.4s\n"
/* relu*/
\
"fmax v9.4s, v9.4s, v2.4s\n"
/* relu*/
\
...
...
@@ -1909,7 +1909,7 @@ inline void gemm_sdot_int8_kernel(const int8_t* a_ptr,
"cmp %[is_relu], #0\n"
/* skip relu */
\
"beq 9f\n"
/* skip relu */
\
"cmp %[is_relu], #1\n"
/* check if has relu6 */
\
"b
eq
10f\n"
/* skip relu */
\
"b
ne
10f\n"
/* skip relu */
\
"vmov.i32 q15, #0\n"
/* for relu */
\
"vmax.f32 q8, q8, q15\n"
/* relu */
\
"vmax.f32 q9, q9, q15\n"
/* relu */
\
...
...
@@ -1925,7 +1925,7 @@ inline void gemm_sdot_int8_kernel(const int8_t* a_ptr,
/* do relu6 */
\
"10: \n" \
"cmp %[is_relu], #2\n"
/*heck if has relu6*/
\
"b
eq
11f\n"
/* skip relu */
\
"b
ne
11f\n"
/* skip relu */
\
"vmov.i32 q15, #0\n"
/* for relu */
\
"vmax.f32 q8, q8, q15\n"
/* relu */
\
"vmax.f32 q9, q9, q15\n"
/* relu */
\
...
...
lite/tests/math/conv_compute_test.cc
浏览文件 @
0559b0a6
...
...
@@ -221,6 +221,11 @@ void test_conv_fp32(const std::vector<DDim>& input_dims,
flag_act
,
six
,
leakey_relu_scale
);
if
(
flag_act
==
2
)
{
// relu6
for
(
int
i
=
0
;
i
<
dim_out
.
production
();
i
++
)
{
dout_basic_fp32
[
i
]
=
dout_basic
[
i
]
>
six
?
six
:
dout_basic
[
i
];
}
}
}
/// warm up
for
(
int
i
=
0
;
i
<
FLAGS_warmup
;
++
i
)
{
...
...
lite/tests/math/conv_int8_compute_test.cc
浏览文件 @
0559b0a6
...
...
@@ -324,15 +324,8 @@ void test_conv_int8(const std::vector<DDim>& input_dims,
if
(
flag_act
==
2
)
{
// relu6
for
(
int
i
=
0
;
i
<
dim_out
.
production
();
i
++
)
{
dout_basic_int8
[
i
]
=
dout_basic_int8
[
i
]
>
six
?
six
:
dout_basic_int8
[
i
];
dout_basic_fp32
[
i
]
=
dout_basic_fp32
[
i
]
>
six
?
six
:
dout_basic_fp32
[
i
];
}
}
else
if
(
flag_act
==
4
)
{
// leakyRelu
for
(
int
i
=
0
;
i
<
dim_out
.
production
();
i
++
)
{
float
tmp
=
dout_basic_fp32
[
i
]
/
scale_out
.
data
()[
0
];
tmp
=
tmp
>
0
?
tmp
:
tmp
*
alpha
;
dout_basic_int8
[
i
]
=
static_cast
<
int8_t
>
(
roundf
(
tmp
));
dout_basic_int8
[
i
]
=
dout_basic_int8
[
i
]
<
-
127
?
-
127
:
dout_basic_int8
[
i
];
}
}
}
double
gops
=
2.0
*
dim_out
.
production
()
*
dim_in
[
1
]
*
weight_dim
[
2
]
*
...
...
@@ -491,13 +484,13 @@ void test_conv_int8(const std::vector<DDim>& input_dims,
float
alpha
=
1.
f
)
{}
#endif // LITE_WITH_ARM
#if
1
/// 3x3dw
#if
0
/// 3x3dw
TEST(TestConv3x3DWInt8, test_conv3x3_depthwise) {
if (FLAGS_basic_test) {
for (auto& stride : {1, 2}) {
for (auto& pad : {0, 1}) {
for (auto& flag_bias : {false, true}) {
for
(
auto
&
flag_act
:
{
0
,
1
,
2
,
4
})
{
for (auto& flag_act : {0, 1}) {
for (auto& c : {1, 3, 5, 8, 16, 32}) {
std::vector<DDim> dims;
DDim weights_dim({c, 1, 3, 3});
...
...
@@ -527,13 +520,13 @@ TEST(TestConv3x3DWInt8, test_conv3x3_depthwise) {
}
#endif /// 3x3dw
#if
1
/// 5x5dw
#if
0
/// 5x5dw
TEST(TestConv5x5DWInt8, test_conv5x5_depthwise) {
if (FLAGS_basic_test) {
for (auto& stride : {1, 2}) {
for (auto& pad : {0, 1, 2, 3, 4}) {
for (auto& flag_bias : {false, true}) {
for
(
auto
&
flag_act
:
{
0
,
1
,
2
,
4
})
{
for (auto& flag_act: {0, 1}) {
for (auto& c : {1, 5, 15, 33}) {
std::vector<DDim> dims;
DDim weights_dim({c, 1, 5, 5});
...
...
@@ -602,7 +595,7 @@ TEST(TestConv1x1s1Int8, test_conv1x1s1) {
}
#endif /// conv1x1s1
#if
1
/// conv3x3s1
#if
0
/// conv3x3s1
TEST(TestConv3x3s1Int8, test_conv_3x3s1) {
if (FLAGS_basic_test) {
for (auto& cin : {1, 3, 8, 33}) {
...
...
@@ -612,7 +605,7 @@ TEST(TestConv3x3s1Int8, test_conv_3x3s1) {
for (auto& pad_left : {1, 2}) {
for (auto& pad_right : {1, 2}) {
for (auto& flag_bias : {false, true}) {
for
(
auto
&
flag_act
:
{
0
,
1
,
2
,
4
})
{
for (auto& flag_act : {0, 1}) {
std::vector<DDim> dims;
DDim weights_dim({cout, cin, 3, 3});
for (auto& batch : {1, 2}) {
...
...
@@ -644,7 +637,7 @@ TEST(TestConv3x3s1Int8, test_conv_3x3s1) {
}
#endif /// conv3x3s1
#if
1
/// conv3x3s2
#if
0
/// conv3x3s2
TEST(TestConv3x3s2Int8, test_conv_3x3s2) {
if (FLAGS_basic_test) {
for (auto& cin : {1, 3, 31}) {
...
...
@@ -654,7 +647,7 @@ TEST(TestConv3x3s2Int8, test_conv_3x3s2) {
for (auto& pad_left : {1, 2}) {
for (auto& pad_right : {1, 2}) {
for (auto& flag_bias : {false, true}) {
for
(
auto
&
flag_act
:
{
0
,
1
,
2
,
4
})
{
for (auto& flag_act : {0, 1}) {
std::vector<DDim> dims;
DDim weights_dim({cout, cin, 3, 3});
for (auto& batch : {1, 2}) {
...
...
lite/tests/utils/naive_math_impl.h
浏览文件 @
0559b0a6
...
...
@@ -301,9 +301,9 @@ static void conv_basic(const Dtype1* din,
dst_data_ref
[
out_idx
]
=
dst_data_ref
[
out_idx
]
>
(
Dtype2
)
0
?
dst_data_ref
[
out_idx
]
:
(
Dtype2
)
0
;
dst_data_ref
[
out_idx
]
=
dst_data_ref
[
out_idx
]
<
(
Dtype2
)
six
?
dst_data_ref
[
out_idx
]
:
(
Dtype2
)
six
;
//
dst_data_ref[out_idx] = dst_data_ref[out_idx] < (Dtype2)six
//
? dst_data_ref[out_idx]
//
: (Dtype2)six;
}
else
if
(
act_type
==
4
)
{
dst_data_ref
[
out_idx
]
=
dst_data_ref
[
out_idx
]
>
(
Dtype2
)
0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录