aimet_onnx.apply_adaround

Note

It is recommended to use onnx-simplifier before adarounding the model.

Top-level API

aimet_onnx.apply_adaround(sim, inputs, num_iterations=10000)[source]

Optimizes the rounding direction of weights in the QuantizationSimModel to reduce quantization error.

After applying AdaRound to a QuantizationSimModel object, the quantization encodings will be frozen for optimized weights and the sim model will contain updated weight tensors.

Parameters:
  • sim (QuantizationSimModel) – Calibrated QuantizationSimModel instance to optimize

  • inputs (Collection[Dict[str, np.ndarray]]) – The set of input samples to use during optimization.

  • num_iterations (int) – Number of optimization steps to take for each layer. Recommended value is 10K for weight bitwidths >= 8-bits, 15K for weight bitwidths < 8 bits.