Find concat OP
ConcatOp (OpNeedsQuantize,OpHasAxis)
Find the bottom layer of concat OP
parameter path
- argv->dataset_param, quant_param, calibration_param
- argv(model_name, quantize method, input_scale, ts_max_file, ts_min_file,…param)->aqt
- aqt build with ir(dictionary, contains net_property, op_list, weights_dict) ->build function
- aqt.quantize(statistic max and min files, calibrate, crop to relu6)
if stats_status
do something to self.op_dict_[op_id].top_max(.top_min)
self.op_dict_[op_id] is the instance of op class
self.op_dict_ is a map mapping op_id to op class
op_id=self.top_op_map_[key_flow_node_] - op_id_list=sorted(self.op_dict_)
- cur_op.quantize(input_scale_zp,quantize_param)
input_scale_zp and out_scale_zp are dictionary - OpNeedsQuantilize(Op).quantilize:
initialize accum_q_min,accum_q_max, by quantize_param - then goes to cur_op.quantize
- update self.net_property_[qprec]
In concat quantization
- quantize(self, input_scale_zp, quantize_param)
input_scale_zp[self.bottom_[i]] is a dictionary, key:[‘scale’],[‘quantize_param’]
self.out_scale_zp_={self.top_[0]:{‘scale’:out_scale,‘zp’:0}}
using debug!
ir (dictionary) saved op_list
aqt 中有top_op_map, mapping str to int
concat中的input_scale_zp中含有以名字为key的dictionary,内含scale和zp