未验证 提交 b8167ed2 编写于 作者: C ceci3 提交者: GitHub

quant support matmul_v2 (#36469) (#36499)

* quant support matmul_v2

* fix format
上级 d65f8af8
...@@ -51,6 +51,7 @@ _out_scale_op_list = [ ...@@ -51,6 +51,7 @@ _out_scale_op_list = [
"depthwise_conv2d", "depthwise_conv2d",
"mul", "mul",
"matmul", "matmul",
"matmul_v2",
"relu", "relu",
"leaky_relu", "leaky_relu",
"relu6", "relu6",
...@@ -91,6 +92,7 @@ _op_real_in_out_name = { ...@@ -91,6 +92,7 @@ _op_real_in_out_name = {
"conv2d_transpose": [["Input", "Filter"], ["Output"]], "conv2d_transpose": [["Input", "Filter"], ["Output"]],
"mul": [["X", "Y"], ["Out"]], "mul": [["X", "Y"], ["Out"]],
"matmul": [["X", "Y"], ["Out"]], "matmul": [["X", "Y"], ["Out"]],
"matmul_v2": [["X", "Y"], ["Out"]],
"pool2d": [["X"], ["Out"]], "pool2d": [["X"], ["Out"]],
"elementwise_add": [["X", "Y"], ["Out"]], "elementwise_add": [["X", "Y"], ["Out"]],
"concat": [["X"], ["Out"]], "concat": [["X"], ["Out"]],
...@@ -139,7 +141,9 @@ _op_real_in_out_name = { ...@@ -139,7 +141,9 @@ _op_real_in_out_name = {
_conv_ops = ['conv2d', 'depthwise_conv2d', 'conv2d_transpose'] _conv_ops = ['conv2d', 'depthwise_conv2d', 'conv2d_transpose']
_channelwise_quant_axis1_ops = ['conv2d_transpose', 'mul'] _channelwise_quant_axis1_ops = [
'conv2d_transpose', 'mul', 'matmul', 'matmul_v2'
]
def _get_op_input_var_names(op): def _get_op_input_var_names(op):
...@@ -1785,7 +1789,8 @@ class AddQuantDequantPass(object): ...@@ -1785,7 +1789,8 @@ class AddQuantDequantPass(object):
"bilinear_interp", "nearest_interp", "trilinear_interp", "slice", "bilinear_interp", "nearest_interp", "trilinear_interp", "slice",
"squeeze", "elementwise_sub", "mul", "matmul", "relu", "relu6", "squeeze", "elementwise_sub", "mul", "matmul", "relu", "relu6",
"leaky_relu", "tanh", "swish", "scale", "transpose", "transpose2", "leaky_relu", "tanh", "swish", "scale", "transpose", "transpose2",
"sigmoid", "pad2d", "flatten", "flatten2", "batch_norm", "layer_norm" "sigmoid", "pad2d", "flatten", "flatten2", "batch_norm", "layer_norm",
"matmul_v2"
] ]
# To be compatible with PaddleSlim, not remove _activation_type for now # To be compatible with PaddleSlim, not remove _activation_type for now
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册