mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-25 19:48:11 +00:00
Fix bugs for 1: Calibrator should check model inputs; 2: (#6017)
quantize_inupts forgot to use parameter initializer_use_weight_qtyp.
This commit is contained in:
parent
bdd06f6310
commit
648c9c7789
2 changed files with 3 additions and 2 deletions
|
|
@ -58,6 +58,7 @@ class ONNXCalibrater:
|
|||
model = onnx.shape_inference.infer_shapes(model)
|
||||
value_infos = {vi.name: vi for vi in model.graph.value_info}
|
||||
value_infos.update({ot.name: ot for ot in model.graph.output})
|
||||
value_infos.update({it.name: it for it in model.graph.input})
|
||||
|
||||
added_nodes = []
|
||||
added_outputs = []
|
||||
|
|
@ -264,4 +265,4 @@ def calibrate(model_path,
|
|||
quantization_params_dict = calibrater.calculate_quantization_params(dict_for_quantization)
|
||||
|
||||
print("Calibrated,quantized parameters calculated and returned.")
|
||||
return quantization_params_dict
|
||||
return quantization_params_dict
|
||||
|
|
|
|||
|
|
@ -806,7 +806,7 @@ class ONNXQuantizer:
|
|||
# Quantize the input
|
||||
initializer = find_by_name(node_input, self.model.initializer())
|
||||
if initializer is not None:
|
||||
weight = self._get_quantized_weight(initializer, self.weight_qType)
|
||||
weight = self._get_quantized_weight(initializer, self.weight_qType if initializer_use_weight_qType else self.input_qType)
|
||||
|
||||
# Update graph
|
||||
self._update_weight(weight)
|
||||
|
|
|
|||
Loading…
Reference in a new issue