Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
62c05369
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
62c05369
编写于
9月 23, 2022
作者:
Z
zyfncg
提交者:
GitHub
9月 23, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clear extra attrs of quantize op in opmaker (#46418)
上级
5e878ecc
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
36 addition
and
94 deletion
+36
-94
paddle/fluid/operators/fake_quantize_op.cc
paddle/fluid/operators/fake_quantize_op.cc
+0
-90
paddle/fluid/operators/quantize_linear_op.cc
paddle/fluid/operators/quantize_linear_op.cc
+0
-4
paddle/phi/api/yaml/op_compat.yaml
paddle/phi/api/yaml/op_compat.yaml
+36
-0
未找到文件。
paddle/fluid/operators/fake_quantize_op.cc
浏览文件 @
62c05369
...
...
@@ -432,24 +432,6 @@ class FakeQuantOrWithDequantAbsMaxOpMaker
"the received is %d"
,
bit_length
));
});
AddAttr
<
int
>
(
"round_type"
,
"(int, default 1) The round type of fp32 to int."
"0: rounding to nearest ties to even. Eg: round(1.5)=2, round(2.5)=2"
"1: rounding to nearest ties away from zero. Eg: round(1.5)=2, "
"round(2.5)=3"
)
.
SetDefault
(
1
)
.
AddCustomChecker
([](
const
int
&
round_type
)
{
PADDLE_ENFORCE_EQ
(
round_type
==
0
||
round_type
==
1
,
true
,
platform
::
errors
::
InvalidArgument
(
"'round_type' should be 0 or 1, 0 rounding to "
"nearest ties to even and 1 is rounding to nearest "
"ties away from zero.but the received is %d"
,
round_type
));
})
.
AsExtra
();
AddComment
(
R"DOC(
This is a Base Op which supports FakeQuantAbsMaxOpMaker and FakeQuantDequantAbsMaxOpMaker.
FakeQuantAbsMaxOp operator is used in the dynamic quantization.
...
...
@@ -529,24 +511,6 @@ class FakeChannelWiseQuantizeAbsMaxOpMaker
"the received is %d"
,
bit_length
));
});
AddAttr
<
int
>
(
"round_type"
,
"(int, default 1) The round type of fp32 to int."
"0: rounding to nearest ties to even. Eg: round(1.5)=2, round(2.5)=2"
"1: rounding to nearest ties away from zero. Eg: round(1.5)=2, "
"round(2.5)=3"
)
.
SetDefault
(
1
)
.
AddCustomChecker
([](
const
int
&
round_type
)
{
PADDLE_ENFORCE_EQ
(
round_type
==
0
||
round_type
==
1
,
true
,
platform
::
errors
::
InvalidArgument
(
"'round_type' should be 0 or 1, 0 rounding to "
"nearest ties to even and 1 is rounding to nearest "
"ties away from zero.but the received is %d"
,
round_type
));
})
.
AsExtra
();
AddAttr
<
bool
>
(
"is_test"
,
"(bool, default false) Set to true for inference only, false "
"for training. Some layers may run faster when this is true."
)
...
...
@@ -628,24 +592,6 @@ class FakeChannelWiseQuantizeDequantizeAbsMaxOpMaker
"the received is %d"
,
bit_length
));
});
AddAttr
<
int
>
(
"round_type"
,
"(int, default 1) The round type of fp32 to int."
"0: rounding to nearest ties to even. Eg: round(1.5)=2, round(2.5)=2"
"1: rounding to nearest ties away from zero. Eg: round(1.5)=2, "
"round(2.5)=3"
)
.
SetDefault
(
1
)
.
AddCustomChecker
([](
const
int
&
round_type
)
{
PADDLE_ENFORCE_EQ
(
round_type
==
0
||
round_type
==
1
,
true
,
platform
::
errors
::
InvalidArgument
(
"'round_type' should be 0 or 1, 0 rounding to "
"nearest ties to even and 1 is rounding to nearest "
"ties away from zero.but the received is %d"
,
round_type
));
})
.
AsExtra
();
AddComment
(
R"DOC(
The scale of FakeChannelWiseQuantize operator is a vector.
In detail, each channel of the input X has a scale value.
...
...
@@ -715,24 +661,6 @@ class FakeQuantizeRangeAbsMaxOpMaker
"the received is %d"
,
bit_length
));
});
AddAttr
<
int
>
(
"round_type"
,
"(int, default 1) The round type of fp32 to int."
"0: rounding to nearest ties to even. Eg: round(1.5)=2, round(2.5)=2"
"1: rounding to nearest ties away from zero. Eg: round(1.5)=2, "
"round(2.5)=3"
)
.
SetDefault
(
1
)
.
AddCustomChecker
([](
const
int
&
round_type
)
{
PADDLE_ENFORCE_EQ
(
round_type
==
0
||
round_type
==
1
,
true
,
platform
::
errors
::
InvalidArgument
(
"'round_type' should be 0 or 1, 0 rounding to "
"nearest ties to even and 1 is rounding to nearest "
"ties away from zero.but the received is %d"
,
round_type
));
})
.
AsExtra
();
AddAttr
<
bool
>
(
"is_test"
,
"(bool, default false) Set to true for inference only, false "
"for training. Some layers may run faster when this is true."
)
...
...
@@ -815,24 +743,6 @@ class FakeQuantOrWithDequantMovingAverageAbsMaxOpMaker
"the received is %d"
,
bit_length
));
});
AddAttr
<
int
>
(
"round_type"
,
"(int, default 1) The round type of fp32 to int."
"0: rounding to nearest ties to even. Eg: round(1.5)=2, round(2.5)=2"
"1: rounding to nearest ties away from zero. Eg: round(1.5)=2, "
"round(2.5)=3"
)
.
SetDefault
(
1
)
.
AddCustomChecker
([](
const
int
&
round_type
)
{
PADDLE_ENFORCE_EQ
(
round_type
==
0
||
round_type
==
1
,
true
,
platform
::
errors
::
InvalidArgument
(
"'round_type' should be 0 or 1, 0 rounding to "
"nearest ties to even and 1 is rounding to nearest "
"ties away from zero.but the received is %d"
,
round_type
));
})
.
AsExtra
();
AddAttr
<
bool
>
(
"is_test"
,
"(bool, default false) Set to true for inference only, false "
"for training. Some layers may run faster when this is true."
)
...
...
paddle/fluid/operators/quantize_linear_op.cc
浏览文件 @
62c05369
...
...
@@ -134,10 +134,6 @@ class QuantizeLinearOpMaker : public framework::OpProtoAndCheckerMaker {
AddOutput
(
"OutScale"
,
"(Tensor) Current scale"
)
.
AsDispensable
()
.
AsExtra
();
// only qat use
AddAttr
<
float
>
(
"moving_rate"
,
"(float, default 0.9) moving rate."
)
// only qat use
.
SetDefault
(
0.9
)
.
AsExtra
();
AddAttr
<
int
>
(
"quant_axis"
,
"(int, default 0) The axis for quantization. "
"For conv2d, depthwise_conv2d, conv2d_transpose "
...
...
paddle/phi/api/yaml/op_compat.yaml
浏览文件 @
62c05369
...
...
@@ -179,6 +179,10 @@
str fuse_activation = ""
,
float fuse_alpha = 0.0f
,
float fuse_beta = 0.0f
,
int workspace_size_MB = platform
::
GetDefaultConvWorkspaceSizeLimitMB()
]
-
op
:
dequantize_linear
extra
:
attrs
:
[
float moving_rate = 0.9
]
-
op
:
diag (diag_v2)
backward
:
diag_grad (diag_v2_grad)
inputs
:
...
...
@@ -271,6 +275,34 @@
extra
:
attrs
:
[
bool use_mkldnn = false
,
bool use_cudnn = false
]
-
op
:
fake_channel_wise_quantize_abs_max
extra
:
attrs
:
[
int round_type = 1
]
-
op
:
fake_channel_wise_quantize_dequantize_abs_max
extra
:
attrs
:
[
int round_type = 1
]
-
op
:
fake_quantize_abs_max
extra
:
attrs
:
[
int round_type = 1
]
-
op
:
fake_quantize_dequantize_abs_max
extra
:
attrs
:
[
int round_type = 1
]
-
op
:
fake_quantize_dequantize_moving_average_abs_max
extra
:
attrs
:
[
int round_type = 1
]
-
op
:
fake_quantize_moving_average_abs_max
extra
:
attrs
:
[
int round_type = 1
]
-
op
:
fake_quantize_range_abs_max
extra
:
attrs
:
[
int round_type = 1
]
-
op
:
fft_c2c
inputs
:
{
x
:
X
}
outputs
:
{
out
:
Out
}
...
...
@@ -495,6 +527,10 @@
extra
:
attrs
:
[
bool use_mkldnn = false
,
str mkldnn_data_type = "float32"
,
bool is_test = false
]
-
op
:
quantize_linear
extra
:
attrs
:
[
float moving_rate = 0.9
]
-
op
:
reciprocal
backward
:
reciprocal_grad
extra
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录