AIMET ONNX Cross Layer Equalization APIs

Introduction

AIMET functionality for Cross Layer Equalization has 3 features-
  • BatchNorm Folding

  • Cross Layer Scaling

  • High Bias Fold

Cross Layer Equalization API

The following API performs BatchNorm fold followed by Cross Layer Scaling followed by High Bias Fold.

Note: High Bias fold will not happen when the below API is used, if the model does not have BatchNorm layers

API for Cross Layer Equalization

aimet_onnx.cross_layer_equalization.equalize_model(model)[source]

High-level API to perform Cross-Layer Equalization (CLE) on the given model. The model is equalized in place.

Parameters

model (ModelProto) – Model to equalize


Code Example

Required imports

from aimet_onnx.cross_layer_equalization import equalize_model

Cross Layer Equalization in auto mode

def cross_layer_equalization():
    onnx_model = Model()
    equalize_model(onnx_model)