Skip to content

Commit 7667e59

Browse files
authored
add op version for fake_quant and fake_dequant ops, test=op_version (#29923)
* add op version for fake_quant and fake_dequant ops, test=op_version, test=develop
1 parent acb5e86 commit 7667e59

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

paddle/fluid/operators/fake_dequantize_op.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License. */
1515
#include "paddle/fluid/operators/fake_dequantize_op.h"
1616
#include <string>
1717
#include <vector>
18+
#include "paddle/fluid/framework/op_version_registry.h"
1819

1920
namespace paddle {
2021
namespace operators {
@@ -238,3 +239,10 @@ REGISTER_OPERATOR(
238239
REGISTER_OP_CPU_KERNEL(fake_channel_wise_dequantize_max_abs,
239240
ops::FakeChannelWiseDequantizeMaxAbsKernel<CPU, float>,
240241
ops::FakeChannelWiseDequantizeMaxAbsKernel<CPU, double>);
242+
243+
REGISTER_OP_VERSION(fake_channel_wise_dequantize_max_abs)
244+
.AddCheckpoint(
245+
R"ROC(add new attributes [quant_axis] for applying per-channel "
246+
"dequantization to conv2d_tranpose and mul ops.)ROC",
247+
paddle::framework::compatible::OpVersionDesc().NewAttr(
248+
"quant_axis", "The axis for dequantization.", 0));

paddle/fluid/operators/fake_quantize_op.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License. */
1616
#include <algorithm>
1717
#include <string>
1818
#include "paddle/fluid/framework/eigen.h"
19+
#include "paddle/fluid/framework/op_version_registry.h"
1920
#include "paddle/fluid/operators/clip_op.h"
2021
#include "paddle/fluid/platform/transform.h"
2122

@@ -805,3 +806,10 @@ REGISTER_OPERATOR(fake_channel_wise_quantize_dequantize_abs_max,
805806
REGISTER_OP_CPU_KERNEL(
806807
fake_channel_wise_quantize_dequantize_abs_max,
807808
ops::FakeChannelWiseQuantizeDequantizeAbsMaxKernel<CPU, float>);
809+
810+
REGISTER_OP_VERSION(fake_channel_wise_quantize_abs_max)
811+
.AddCheckpoint(
812+
R"ROC(add new attributes [quant_axis] for applying per-channel "
813+
"quantization to conv2d_tranpose and mul ops.)ROC",
814+
paddle::framework::compatible::OpVersionDesc().NewAttr(
815+
"quant_axis", "The axis for quantization.", 0));

0 commit comments

Comments
 (0)