parameters: (model, create_stats_collector, activations_statistics,
                          fill_fq_range, config, qscheme=None)
return_statement: return model
docstring: Returns a calibrated low precision model via four steps:
      1. Quantize the model
      2. Calculate quantization config for FQ nodes
      3. Collect the weight stats based on config
      4. Calibrate [min, max] for inserted fq nodes
      :param model: original model (CompressedModel instance)
      :param create_stats_collector: functor to create function for stats collector callback
      :param activations_statistics: precomputed statistics for activations layers
      :param fill_fq_range: functor to generate min and max range for fake quantize node
      :param config: dictionary with params algo section from toolkit config
docstring_summary: Returns a calibrated low precision model via four steps:
      1. Quantize the model
      2. Calculate quantization config for FQ nodes
      3. Collect the weight stats based on config
      4. Calibrate [min, max] for inserted fq nodes
      :param model: original model (CompressedModel instance)
      :param create_stats_collector: functor to create function for stats collector callback
      :param activations_statistics: precomputed statistics for activations layers
      :param fill_fq_range: functor to generate min and max range for fake quantize node
      :param config: dictionary with params algo section from toolkit config
docstring_tokens: Returns a calibrated low precision model via four steps : 1 . Quantize the model 2 . Calculate quantization config for FQ nodes 3 . Collect the weight stats based on config 4 . Calibrate [ min max ] for inserted fq nodes : param model : original model ( CompressedModel instance ) : param create_stats_collector : functor to create function for stats collector callback : param activations_statistics : precomputed statistics for activations layers : param fill_fq_range : functor to generate min and max range for fake quantize node : param config : dictionary with params algo section from toolkit config
function: def get_quantized_model(model, create_stats_collector, activations_statistics,
                          fill_fq_range, config, qscheme=None):
      """
      Returns a calibrated low precision model via four steps:
      1. Quantize the model
      2. Calculate quantization config for FQ nodes
      3. Collect the weight stats based on config
      4. Calibrate [min, max] for inserted fq nodes
      :param model: original model (CompressedModel instance)
      :param create_stats_collector: functor to create function for stats collector callback
      :param activations_statistics: precomputed statistics for activations layers
      :param fill_fq_range: functor to generate min and max range for fake quantize node
      :param config: dictionary with params algo section from toolkit config
       """
      # FakeQuantize nodes insertion
      insert_fake_quantize_nodes(config, model, qscheme=qscheme)
  
      fake_quantize_config = compute_stats_layouts(config, model, qscheme=qscheme)
  
      # generate a list of fq nodes that require rescaling (first convolutions weight FQs)
      fake_quantize_config.update(set_rescaling_factors(config, model))
  
      weights_stats_layout = create_stats_collector(fake_quantize_config, model, for_weights=True)
  
      # compute weights statistics
      weights_stats = compute_weights_stats(model, weights_stats_layout)
  
      # calculate and fill min and max range for fq nodes
      fill_fq_range(model, weights_stats, activations_statistics, fake_quantize_config, config)
      return model
function_tokens: def get_quantized_model ( model , create_stats_collector , activations_statistics , fill_fq_range , config , qscheme = None ) : # FakeQuantize nodes insertion insert_fake_quantize_nodes ( config , model , qscheme = qscheme ) fake_quantize_config = compute_stats_layouts ( config , model , qscheme = qscheme ) # generate a list of fq nodes that require rescaling (first convolutions weight FQs) fake_quantize_config . update ( set_rescaling_factors ( config , model ) ) weights_stats_layout = create_stats_collector ( fake_quantize_config , model , for_weights = True ) # compute weights statistics weights_stats = compute_weights_stats ( model , weights_stats_layout ) # calculate and fill min and max range for fq nodes fill_fq_range ( model , weights_stats , activations_statistics , fake_quantize_config , config ) return model