Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
8ead391d
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8ead391d
编写于
6月 19, 2019
作者:
N
nhzlx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ci error
上级
e8ebb084
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
19 deletion
+28
-19
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.cc
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.cc
+0
-3
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.h
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.h
+12
-0
paddle/fluid/lite/core/optimizer.h
paddle/fluid/lite/core/optimizer.h
+12
-12
paddle/fluid/lite/operators/fake_dequantize_max_abs.h
paddle/fluid/lite/operators/fake_dequantize_max_abs.h
+2
-2
paddle/fluid/lite/operators/fake_quantize_moving_avg_max_abs.h
...e/fluid/lite/operators/fake_quantize_moving_avg_max_abs.h
+2
-2
未找到文件。
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.cc
浏览文件 @
8ead391d
...
...
@@ -99,15 +99,12 @@ void QuantDequantOpFuser::InsertNewNode(SSAGraph* graph,
const
int
kNumFields
=
5
;
const
int
kQuantizedWeightOffset
=
0
;
const
int
kQuantizedOpOffset
=
1
;
const
int
kQuantizedOpOutOffset
=
2
;
const
int
kDequantOpOffset
=
3
;
const
int
kDequantOpOutOffset
=
4
;
auto
*
quant_op_input
=
matched
.
at
(
"quant_op_input"
);
auto
*
quant_op_in_scale
=
matched
.
at
(
"quant_op_in_scale"
);
auto
*
quant_op
=
matched
.
at
(
"quant_op"
);
auto
*
quant_op_out_scale
=
matched
.
at
(
"quant_op_out_scale"
);
auto
*
quant_op_out
=
matched
.
at
(
"quant_op_out"
);
std
::
vector
<
Node
*>
nodes
;
for
(
int
i
=
0
;
i
<
times_
;
i
++
)
{
...
...
paddle/fluid/lite/core/mir/fusion/quant_dequant_op_fuser.h
浏览文件 @
8ead391d
...
...
@@ -23,6 +23,18 @@ namespace lite {
namespace
mir
{
namespace
fusion
{
/* The model trained by fluid quantization is a simulation of real int8.
* The quantized Ops(conv2d, mul, depthwise conv2d etc) have fake_quantop
* in front and fake_dequantop behind.
*
* When in int8 mode, the pattern like "fake_quant + quantized_op +
* fake_dequant"
* can be detected by this fuser. The fuser extract the input_scale and
* the weight_scale info from fake_quant, fake_dequant op and fuse those into
* the quantized_op.
* In addition, the fuser delete fake_quant and fake_dequant op in the graph at
* the last.
*/
class
QuantDequantOpFuser
:
public
FuseBase
{
public:
explicit
QuantDequantOpFuser
(
const
std
::
string
&
op_type
,
...
...
paddle/fluid/lite/core/optimizer.h
浏览文件 @
8ead391d
...
...
@@ -48,22 +48,22 @@ class Optimizer {
if
(
passes
.
empty
())
{
RunPasses
(
std
::
vector
<
std
::
string
>
{{
"lite_quant_dequant_fuse_pass"
,
//
"lite_conv_bn_fuse_pass"
,
//
"lite_quant_dequant_fuse_pass"
,
//
"lite_conv_bn_fuse_pass"
,
//
"lite_conv_elementwise_add_activation_fuse_pass"
,
//
#ifdef LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
"lite_elementwise_add_activation_fuse_pass"
,
//
#endif
"lite_fc_fuse_pass"
,
//
"static_kernel_pick_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"type_target_transform_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"io_copy_kernel_pick_pass"
,
//
"variable_place_inference_pass"
,
//
"runtime_context_assign_pass"
,
//
"lite_fc_fuse_pass"
,
//
"static_kernel_pick_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"type_target_transform_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"io_copy_kernel_pick_pass"
,
//
"variable_place_inference_pass"
,
//
"runtime_context_assign_pass"
,
//
}});
}
else
{
RunPasses
(
passes
);
...
...
paddle/fluid/lite/operators/fake_dequantize_max_abs.h
浏览文件 @
8ead391d
...
...
@@ -33,9 +33,9 @@ class FakeDequantizeMaxAbsOpLite : public OpLite {
explicit
FakeDequantizeMaxAbsOpLite
(
const
std
::
string
&
type
)
:
OpLite
(
type
)
{}
bool
CheckShape
()
const
override
{}
bool
CheckShape
()
const
override
{
return
true
;
}
bool
InferShape
()
const
override
{}
bool
InferShape
()
const
override
{
return
true
;
}
bool
AttachImpl
(
const
cpp
::
OpDesc
&
op_desc
,
lite
::
Scope
*
scope
)
override
{
auto
x
=
op_desc
.
Input
(
"X"
).
front
();
...
...
paddle/fluid/lite/operators/fake_quantize_moving_avg_max_abs.h
浏览文件 @
8ead391d
...
...
@@ -34,9 +34,9 @@ class FakeQuantizeMovingAvgMaxAbsOpLite : public OpLite {
explicit
FakeQuantizeMovingAvgMaxAbsOpLite
(
const
std
::
string
&
type
)
:
OpLite
(
type
)
{}
bool
CheckShape
()
const
override
{}
bool
CheckShape
()
const
override
{
return
true
;
}
bool
InferShape
()
const
override
{}
bool
InferShape
()
const
override
{
return
true
;
}
bool
AttachImpl
(
const
cpp
::
OpDesc
&
op_desc
,
lite
::
Scope
*
scope
)
override
{
auto
x
=
op_desc
.
Input
(
"X"
).
front
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录