Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
5c9894d3
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5c9894d3
编写于
6月 28, 2019
作者:
N
nhzlx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refine INT8 conv compute
上级
0731af04
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
12 addition
and
5 deletion
+12
-5
paddle/fluid/lite/api/cxx_api_bin_int8.cc
paddle/fluid/lite/api/cxx_api_bin_int8.cc
+10
-2
paddle/fluid/lite/kernels/arm/conv_compute.cc
paddle/fluid/lite/kernels/arm/conv_compute.cc
+2
-3
未找到文件。
paddle/fluid/lite/api/cxx_api_bin_int8.cc
浏览文件 @
5c9894d3
...
@@ -34,6 +34,7 @@ double time_diff(Time t1, Time t2) {
...
@@ -34,6 +34,7 @@ double time_diff(Time t1, Time t2) {
void
Run
(
const
char
*
model_dir
,
int
repeat
)
{
void
Run
(
const
char
*
model_dir
,
int
repeat
)
{
#ifdef LITE_WITH_ARM
#ifdef LITE_WITH_ARM
DeviceInfo
::
Init
();
DeviceInfo
::
Init
();
DeviceInfo
::
Global
().
SetRunMode
(
LITE_POWER_HIGH
,
1
);
#endif
#endif
lite
::
Predictor
predictor
;
lite
::
Predictor
predictor
;
std
::
vector
<
Place
>
valid_places
({
std
::
vector
<
Place
>
valid_places
({
...
@@ -52,6 +53,7 @@ void Run(const char* model_dir, int repeat) {
...
@@ -52,6 +53,7 @@ void Run(const char* model_dir, int repeat) {
data
[
i
]
=
1
;
data
[
i
]
=
1
;
}
}
for
(
int
i
=
0
;
i
<
10
;
i
++
)
predictor
.
Run
();
auto
time1
=
time
();
auto
time1
=
time
();
for
(
int
i
=
0
;
i
<
repeat
;
i
++
)
predictor
.
Run
();
for
(
int
i
=
0
;
i
<
repeat
;
i
++
)
predictor
.
Run
();
auto
time2
=
time
();
auto
time2
=
time
();
...
@@ -60,10 +62,16 @@ void Run(const char* model_dir, int repeat) {
...
@@ -60,10 +62,16 @@ void Run(const char* model_dir, int repeat) {
auto
*
out
=
predictor
.
GetOutput
(
0
);
auto
*
out
=
predictor
.
GetOutput
(
0
);
LOG
(
INFO
)
<<
out
<<
" memory size "
<<
out
->
data_size
();
LOG
(
INFO
)
<<
out
<<
" memory size "
<<
out
->
data_size
();
LOG
(
INFO
)
<<
"out "
<<
out
->
data
<
float
>
()[
0
];
LOG
(
INFO
)
<<
"out "
<<
out
->
data
<
float
>
()[
1
];
LOG
(
INFO
)
<<
"dims "
<<
out
->
dims
();
LOG
(
INFO
)
<<
"dims "
<<
out
->
dims
();
LOG
(
INFO
)
<<
"out data size: "
<<
out
->
data_size
();
LOG
(
INFO
)
<<
"out data size: "
<<
out
->
data_size
();
/*
float sum = 0.;
for (int i = 0; i < out->data_size(); i++) {
LOG(INFO) << "out " << out->data<float>()[i];
sum += out->data<float>()[i];
}
LOG(INFO) << sum;
*/
}
}
}
// namespace lite
}
// namespace lite
...
...
paddle/fluid/lite/kernels/arm/conv_compute.cc
浏览文件 @
5c9894d3
...
@@ -74,7 +74,7 @@ void ConvCompute::PrepareForRun() {
...
@@ -74,7 +74,7 @@ void ConvCompute::PrepareForRun() {
}
else
if
(
param
.
groups
==
1
&&
kw
==
3
&&
stride
==
2
&&
kps_equal
&&
}
else
if
(
param
.
groups
==
1
&&
kw
==
3
&&
stride
==
2
&&
kps_equal
&&
no_dilation
)
{
no_dilation
)
{
// direct conv impl
// direct conv impl
impl_
=
new
lite
::
arm
::
math
::
Direct
Conv
<
PRECISION
(
kFloat
)
>
;
impl_
=
new
lite
::
arm
::
math
::
GemmLike
Conv
<
PRECISION
(
kFloat
)
>
;
VLOG
(
3
)
<<
"invoking direct conv"
;
VLOG
(
3
)
<<
"invoking direct conv"
;
}
else
{
}
else
{
impl_
=
new
lite
::
arm
::
math
::
GemmLikeConv
<
PRECISION
(
kFloat
)
>
;
impl_
=
new
lite
::
arm
::
math
::
GemmLikeConv
<
PRECISION
(
kFloat
)
>
;
...
@@ -123,8 +123,7 @@ void ConvComputeInt8<Ptype_out>::PrepareForRun() {
...
@@ -123,8 +123,7 @@ void ConvComputeInt8<Ptype_out>::PrepareForRun() {
// weigth is int8 and bias is int32 so do not need trans
// weigth is int8 and bias is int32 so do not need trans
if
(
param
.
groups
==
ic
&&
ic
==
oc
&&
kps_equal
&&
no_dilation
&&
flag_dw
)
{
if
(
param
.
groups
==
ic
&&
ic
==
oc
&&
kps_equal
&&
no_dilation
&&
flag_dw
)
{
// impl_ = new lite::arm::math::DepthwiseConvInt8<Ptype_out>;
impl_
=
new
lite
::
arm
::
math
::
DepthwiseConvInt8
<
Ptype_out
>
;
impl_
=
new
lite
::
arm
::
math
::
GemmLikeConvInt8
<
Ptype_out
>
;
VLOG
(
3
)
<<
"Run DepthwiseConv Int8"
;
VLOG
(
3
)
<<
"Run DepthwiseConv Int8"
;
}
else
if
(
param
.
groups
==
1
&&
kw
==
3
&&
(
sw
==
1
||
sw
==
2
)
&&
}
else
if
(
param
.
groups
==
1
&&
kw
==
3
&&
(
sw
==
1
||
sw
==
2
)
&&
kps_equal
&&
no_dilation
)
{
kps_equal
&&
no_dilation
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录