mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-18 21:21:17 +00:00
Fix bug in the back to back quantization of matmul and conv (#5264)
* fix bug in the back to back quantization of matmul and conv * fix bug in back to back gather
This commit is contained in:
parent
b5a6a8e847
commit
61ba5b501a
4 changed files with 4 additions and 4 deletions
|
|
@ -127,7 +127,7 @@ class ONNXModel:
|
|||
nodes.append(node)
|
||||
return nodes
|
||||
|
||||
def save_model_to_file(self, output_path, use_external_data_format=False):
|
||||
def save_model_to_file(self, output_path, use_external_data_format=False):
|
||||
'''
|
||||
Save model to external data, which is needed for model size > 2GB
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class ConvInteger(QuantOperatorBase):
|
|||
quantized_bias_name = self.quantizer.quantize_bias(node, nodes)
|
||||
bias_present = True
|
||||
|
||||
conv_integer_output = node.output[0] + "_quantized"
|
||||
conv_integer_output = node.output[0] + "_output_quantized"
|
||||
conv_integer_name = node.name + "_quant" if node.name != "" else ""
|
||||
|
||||
kwargs = {}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class GatherQuant(QuantOperatorBase):
|
|||
node = self.node
|
||||
assert (node.op_type == "Gather")
|
||||
if (not self.quantizer._is_valid_quantize_weight(node.input[0])):
|
||||
self.quantizer.new_nodes += [node]
|
||||
super().quantize()
|
||||
return
|
||||
|
||||
(quantized_input_names, zero_point_names, scale_names, nodes) = \
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class MatMulInteger(QuantOperatorBase):
|
|||
(quantized_input_names, zero_point_names, scale_names, nodes) = \
|
||||
self.quantizer.quantize_inputs(node, [0, 1])
|
||||
|
||||
matmul_integer_output = node.output[0] + "_quantized"
|
||||
matmul_integer_output = node.output[0] + "_output_quantized"
|
||||
matmul_integer_name = node.name + "_quant" if node.name != "" else ""
|
||||
matmul_integer_node = onnx.helper.make_node("MatMulInteger", quantized_input_names + zero_point_names,
|
||||
[matmul_integer_output], matmul_integer_name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue