afe.core.quantization_aware_partitioning

Functions

select_quantization_aware_partition(→ List[str])

Runs the quantization-aware partitioning of the input floating-point AwesomeNet.

initialize_quantization_aware_partitioning_summary(→ str)

add_performance_value_to_summary(→ str)

add_fixed_node_info_to_summary(→ str)

finalize_and_print_summary(achieved_performance, ...)

Module Contents

afe.core.quantization_aware_partitioning.select_quantization_aware_partition(fp32_net: afe.ir.net.AwesomeNet, model_config: afe.core.configs.ModelConfigs, opt_config: afe.core.configs.OptimizationConfigs, qap_configs: afe.core.configs.QuantizationAwarePartitioningConfigs, calibration_generator: sima_utils.data.data_generator.DataGenerator, graph_evaluator: afe.core.evaluate_networks.GraphEvaluator) List[str][source]

Runs the quantization-aware partitioning of the input floating-point AwesomeNet. Selects the nodes that should be run in higher precision.

Steps in QAP are as follows:
  • Analyze the performance of floating-point AwesomeNet for reference.

  • Calibrate the network.

  • Execute loop which quantizes the network, analyzes its performance and, if the performance is not sufficient, finds the node with the highest quantization error and fixes it to floating-point.

Parameters:
  • fp32_net – AwesomeNet.

  • model_config – ModelConfigs. Configuration parameters for model.

  • opt_config – OptimizationConfigs. Configuration parameters used in AwesomeNet calibration and quantization.

  • qap_configs – QuantizationAwarePartitioningConfigs. Configuration parameters for quantization-aware partitioning algorithm.

  • calibration_generator – DataGenerator. Used to generate data used in calibration.

  • graph_evaluator – GraphEvaluator. Holds objects used in graph evaluation.

Returns:

List[str]. The list of nodes that should be set to floating point and executed on EV.

afe.core.quantization_aware_partitioning.initialize_quantization_aware_partitioning_summary(model_name: str, fp32_performance: float, target_performance: float) str[source]
afe.core.quantization_aware_partitioning.add_performance_value_to_summary(performance: float, target_performance: float, summary: str) str[source]
afe.core.quantization_aware_partitioning.add_fixed_node_info_to_summary(fixed_node: str, summary: str) str[source]
afe.core.quantization_aware_partitioning.finalize_and_print_summary(achieved_performance: float, target_performance: float, max_iterations: int, summary: str)[source]