From 2c10ca641ff501a3ec35424fc250e72dfd7dc690 Mon Sep 17 00:00:00 2001 From: cc <52520497+juncaipeng@users.noreply.github.com> Date: Mon, 7 Jun 2021 11:27:56 +0800 Subject: [PATCH] Add op def for quant ops (#33351) --- .../fake_channel_wise_quantize_abs_max.pbtxt | 46 ++++++++++++++ .../compat/fake_dequantize_max_abs.pbtxt | 38 ++++++++++++ .../compat/fake_quantize_abs_max.pbtxt | 38 ++++++++++++ ...fake_quantize_moving_average_abs_max.pbtxt | 61 +++++++++++++++++++ .../compat/fake_quantize_range_abs_max.pbtxt | 55 +++++++++++++++++ .../operators/compat/fill_constant.pbtxt | 61 +++++++++++++++++++ 6 files changed, 299 insertions(+) create mode 100644 paddle/fluid/operators/compat/fake_channel_wise_quantize_abs_max.pbtxt create mode 100644 paddle/fluid/operators/compat/fake_dequantize_max_abs.pbtxt create mode 100644 paddle/fluid/operators/compat/fake_quantize_abs_max.pbtxt create mode 100644 paddle/fluid/operators/compat/fake_quantize_moving_average_abs_max.pbtxt create mode 100644 paddle/fluid/operators/compat/fake_quantize_range_abs_max.pbtxt create mode 100644 paddle/fluid/operators/compat/fill_constant.pbtxt diff --git a/paddle/fluid/operators/compat/fake_channel_wise_quantize_abs_max.pbtxt b/paddle/fluid/operators/compat/fake_channel_wise_quantize_abs_max.pbtxt new file mode 100644 index 00000000000..22954c9ba22 --- /dev/null +++ b/paddle/fluid/operators/compat/fake_channel_wise_quantize_abs_max.pbtxt @@ -0,0 +1,46 @@ +type: "fake_channel_wise_quantize_abs_max" +def { + inputs { + name: "X" + } + outputs { + name: "Out" + } + outputs { + name: "OutScale" + } + attrs { + name: "quant_axis" + type: INT + } + attrs { + name: "bit_length" + type: INT + } +} +extra { + attrs { + name: "is_test" + type: BOOLEAN + } + attrs { + name: "op_role" + type: INT + } + attrs { + name: "op_role_var" + type: STRINGS + } + attrs { + name: "op_namescope" + type: STRING + } + attrs { + name: "op_callstack" + type: STRINGS + } + attrs { + name: "op_device" + type: STRING + } +} diff --git a/paddle/fluid/operators/compat/fake_dequantize_max_abs.pbtxt b/paddle/fluid/operators/compat/fake_dequantize_max_abs.pbtxt new file mode 100644 index 00000000000..0a55c0e4486 --- /dev/null +++ b/paddle/fluid/operators/compat/fake_dequantize_max_abs.pbtxt @@ -0,0 +1,38 @@ +type: "fake_dequantize_max_abs" +def { + inputs { + name: "X" + } + inputs { + name: "Scale" + } + outputs { + name: "Out" + } + attrs { + name: "max_range" + type: FLOAT + } +} +extra { + attrs { + name: "op_role" + type: INT + } + attrs { + name: "op_role_var" + type: STRINGS + } + attrs { + name: "op_namescope" + type: STRING + } + attrs { + name: "op_callstack" + type: STRINGS + } + attrs { + name: "op_device" + type: STRING + } +} diff --git a/paddle/fluid/operators/compat/fake_quantize_abs_max.pbtxt b/paddle/fluid/operators/compat/fake_quantize_abs_max.pbtxt new file mode 100644 index 00000000000..92ee54eb94c --- /dev/null +++ b/paddle/fluid/operators/compat/fake_quantize_abs_max.pbtxt @@ -0,0 +1,38 @@ +type: "fake_quantize_abs_max" +def { + inputs { + name: "X" + } + outputs { + name: "Out" + } + outputs { + name: "OutScale" + } + attrs { + name: "bit_length" + type: INT + } +} +extra { + attrs { + name: "op_role" + type: INT + } + attrs { + name: "op_role_var" + type: STRINGS + } + attrs { + name: "op_namescope" + type: STRING + } + attrs { + name: "op_callstack" + type: STRINGS + } + attrs { + name: "op_device" + type: STRING + } +} diff --git a/paddle/fluid/operators/compat/fake_quantize_moving_average_abs_max.pbtxt b/paddle/fluid/operators/compat/fake_quantize_moving_average_abs_max.pbtxt new file mode 100644 index 00000000000..dddb58f827e --- /dev/null +++ b/paddle/fluid/operators/compat/fake_quantize_moving_average_abs_max.pbtxt @@ -0,0 +1,61 @@ +type: "fake_quantize_moving_average_abs_max" +def { + inputs { + name: "X" + } + inputs { + name: "InScale" + } + inputs { + name: "InAccum" + } + inputs { + name: "InState" + } + outputs { + name: "Out" + } + outputs { + name: "OutScale" + } + outputs { + name: "OutState" + } + outputs { + name: "OutAccum" + } + attrs { + name: "moving_rate" + type: FLOAT + } + attrs { + name: "bit_length" + type: INT + } +} +extra { + attrs { + name: "is_test" + type: BOOLEAN + } + attrs { + name: "op_role" + type: INT + } + attrs { + name: "op_role_var" + type: STRINGS + } + attrs { + name: "op_namescope" + type: STRING + } + attrs { + name: "op_callstack" + type: STRINGS + } + attrs { + name: "op_device" + type: STRING + } +} diff --git a/paddle/fluid/operators/compat/fake_quantize_range_abs_max.pbtxt b/paddle/fluid/operators/compat/fake_quantize_range_abs_max.pbtxt new file mode 100644 index 00000000000..1050b724ee6 --- /dev/null +++ b/paddle/fluid/operators/compat/fake_quantize_range_abs_max.pbtxt @@ -0,0 +1,55 @@ +type: "fake_quantize_range_abs_max" +def { + inputs { + name: "X" + } + inputs { + name: "InScale" + } + inputs { + name: "Iter" + } + outputs { + name: "Out" + } + outputs { + name: "OutScale" + } + outputs { + name: "OutScales" + } + attrs { + name: "window_size" + type: INT + } + attrs { + name: "bit_length" + type: INT + } +} +extra { + attrs { + name: "is_test" + type: BOOLEAN + } + attrs { + name: "op_role" + type: INT + } + attrs { + name: "op_role_var" + type: STRINGS + } + attrs { + name: "op_namescope" + type: STRING + } + attrs { + name: "op_callstack" + type: STRINGS + } + attrs { + name: "op_device" + type: STRING + } +} diff --git a/paddle/fluid/operators/compat/fill_constant.pbtxt b/paddle/fluid/operators/compat/fill_constant.pbtxt new file mode 100644 index 00000000000..b525da04a0d --- /dev/null +++ b/paddle/fluid/operators/compat/fill_constant.pbtxt @@ -0,0 +1,61 @@ +type: "fill_constant" +def { + inputs { + name: "ValueTensor" + } + inputs { + name: "ShapeTensor" + } + inputs { + name: "ShapeTensorList" + } + outputs { + name: "Out" + } + attrs { + name: "dtype" + type: INT + } + attrs { + name: "shape" + type: LONGS + } + attrs { + name: "value" + type: FLOAT + } + attrs { + name: "str_value" + type: STRING + } +} +extra { + attrs { + name: "force_cpu" + type: BOOLEAN + } + attrs { + name: "place_type" + type: INT + } + attrs { + name: "op_role" + type: INT + } + attrs { + name: "op_role_var" + type: STRINGS + } + attrs { + name: "op_namescope" + type: STRING + } + attrs { + name: "op_callstack" + type: STRINGS + } + attrs { + name: "op_device" + type: STRING + } +} -- GitLab