quantization tool better support operator when subgraph is enabled (#9463)

* Fix is_valid_quantize_weight recursive issue when enable subgraph.

* some clear
This commit is contained in:
Zhang Lei 2021-10-26 15:36:19 -07:00 committed by GitHub
parent 33ef1d7700
commit c1b0f924b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -320,7 +320,11 @@ class ONNXQuantizer:
def is_valid_quantize_weight(self, weight_name):
weight = find_by_name(weight_name, self.model.initializer())
return weight is not None and weight.data_type == onnx_proto.TensorProto.FLOAT
if weight is not None:
return weight.data_type == onnx_proto.TensorProto.FLOAT
if (not self.enable_subgraph_quantization) or (self.parent is None):
return False
return self.parent.is_valid_quantize_weight(weight_name)
def _get_dynamic_input_quantization_params(self, input_name, nodes_list, qType):
'''