diff --git a/paddle/fluid/operators/fake_dequantize_op.cc b/paddle/fluid/operators/fake_dequantize_op.cc index 9b0328b0945ba9b57cb9ab27233656e3b0af4f5f..b70fe78e1a528279e4ba6369c04b5771dfa287a0 100644 --- a/paddle/fluid/operators/fake_dequantize_op.cc +++ b/paddle/fluid/operators/fake_dequantize_op.cc @@ -15,6 +15,7 @@ limitations under the License. */ #include "paddle/fluid/operators/fake_dequantize_op.h" #include #include +#include "paddle/fluid/framework/op_version_registry.h" namespace paddle { namespace operators { @@ -238,3 +239,10 @@ REGISTER_OPERATOR( REGISTER_OP_CPU_KERNEL(fake_channel_wise_dequantize_max_abs, ops::FakeChannelWiseDequantizeMaxAbsKernel, ops::FakeChannelWiseDequantizeMaxAbsKernel); + +REGISTER_OP_VERSION(fake_channel_wise_dequantize_max_abs) + .AddCheckpoint( + R"ROC(add new attributes [quant_axis] for applying per-channel " + "dequantization to conv2d_tranpose and mul ops.)ROC", + paddle::framework::compatible::OpVersionDesc().NewAttr( + "quant_axis", "The axis for dequantization.", 0)); diff --git a/paddle/fluid/operators/fake_quantize_op.cc b/paddle/fluid/operators/fake_quantize_op.cc index 04fa8db9a5a6fa4b3b49b6432a564d472f130841..df4debb62033268d9cccdf908794d1c163469a03 100644 --- a/paddle/fluid/operators/fake_quantize_op.cc +++ b/paddle/fluid/operators/fake_quantize_op.cc @@ -16,6 +16,7 @@ limitations under the License. */ #include #include #include "paddle/fluid/framework/eigen.h" +#include "paddle/fluid/framework/op_version_registry.h" #include "paddle/fluid/operators/clip_op.h" #include "paddle/fluid/platform/transform.h" @@ -805,3 +806,10 @@ REGISTER_OPERATOR(fake_channel_wise_quantize_dequantize_abs_max, REGISTER_OP_CPU_KERNEL( fake_channel_wise_quantize_dequantize_abs_max, ops::FakeChannelWiseQuantizeDequantizeAbsMaxKernel); + +REGISTER_OP_VERSION(fake_channel_wise_quantize_abs_max) + .AddCheckpoint( + R"ROC(add new attributes [quant_axis] for applying per-channel " + "quantization to conv2d_tranpose and mul ops.)ROC", + paddle::framework::compatible::OpVersionDesc().NewAttr( + "quant_axis", "The axis for quantization.", 0));