Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f149ce86
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看板
提交
f149ce86
编写于
3月 20, 2020
作者:
C
cc
提交者:
GitHub
3月 20, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add arm int8 place automatic, test=develop (#3234)
上级
2cb7e4ff
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
7 deletion
+26
-7
lite/api/cxx_api.cc
lite/api/cxx_api.cc
+26
-0
lite/api/opt.cc
lite/api/opt.cc
+0
-7
未找到文件。
lite/api/cxx_api.cc
浏览文件 @
f149ce86
...
...
@@ -294,6 +294,32 @@ void Predictor::Build(const cpp::ProgramDesc &desc,
inner_places
.
emplace_back
(
TARGET
(
kHost
),
PRECISION
(
kAny
),
DATALAYOUT
(
kAny
));
inner_places
.
emplace_back
(
TARGET
(
kHost
),
PRECISION
(
kFloat
),
DATALAYOUT
(
kNCHW
));
const
std
::
vector
<
std
::
string
>
quant_dequant_op
=
{
"fake_quantize_abs_max"
,
"fake_quantize_range_abs_max"
,
"fake_quantize_moving_average_abs_max"
,
"fake_quantize_dequantize_moving_average_abs_max"
,
"fake_dequantize_max_abs"
,
"fake_channel_wise_dequantize_max_abs"
};
bool
is_quantized_model
=
false
;
for
(
size_t
i
=
0
;
i
<
program_desc_
.
BlocksSize
()
&&
!
is_quantized_model
;
++
i
)
{
auto
*
block_desc
=
program_desc_
.
GetBlock
<
cpp
::
BlockDesc
>
(
i
);
for
(
size_t
j
=
0
;
j
<
block_desc
->
OpsSize
()
&&
!
is_quantized_model
;
++
j
)
{
auto
*
op_desc
=
block_desc
->
GetOp
<
cpp
::
OpDesc
>
(
j
);
std
::
string
op_type
=
op_desc
->
Type
();
if
(
std
::
find
(
quant_dequant_op
.
begin
(),
quant_dequant_op
.
end
(),
op_type
)
!=
quant_dequant_op
.
end
())
{
is_quantized_model
=
true
;
}
}
}
if
(
is_quantized_model
)
{
inner_places
.
emplace_back
(
Place
{
TARGET
(
kARM
),
PRECISION
(
kInt8
)});
}
Program
program
(
desc
,
scope_
,
inner_places
);
core
::
KernelPickFactor
factor
;
...
...
lite/api/opt.cc
浏览文件 @
f149ce86
...
...
@@ -67,7 +67,6 @@ DEFINE_string(valid_targets,
"arm"
,
"The targets this model optimized for, should be one of (arm, "
"opencl, x86), splitted by space"
);
DEFINE_bool
(
prefer_int8_kernel
,
false
,
"Prefer to run model with int8 kernels"
);
DEFINE_bool
(
print_supported_ops
,
false
,
"Print supported operators on the inputed target"
);
...
...
@@ -121,11 +120,6 @@ std::vector<Place> ParserValidPlaces() {
<<
"At least one target should be set, should set the "
"command argument 'valid_targets'"
;
if
(
FLAGS_prefer_int8_kernel
)
{
LOG
(
WARNING
)
<<
"Int8 mode is only support by ARM target"
;
valid_places
.
insert
(
valid_places
.
begin
(),
Place
{
TARGET
(
kARM
),
PRECISION
(
kInt8
)});
}
return
valid_places
;
}
...
...
@@ -255,7 +249,6 @@ void PrintHelpInfo() {
" `--optimize_out_type=(protobuf|naive_buffer)`
\n
"
" `--optimize_out=<output_optimize_model_dir>`
\n
"
" `--valid_targets=(arm|opencl|x86|npu|xpu)`
\n
"
" `--prefer_int8_kernel=(true|false)`
\n
"
" `--record_tailoring_info=(true|false)`
\n
"
" Arguments of model checking and ops information:
\n
"
" `--print_all_ops=true` Display all the valid operators of "
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录