afe.ir.transform ================ .. py:module:: afe.ir.transform Submodules ---------- .. toctree:: :maxdepth: 1 /pages/api_reference/python-autoapi/afe/ir/transform/base_transform/index /pages/api_reference/python-autoapi/afe/ir/transform/calibration_transforms/index /pages/api_reference/python-autoapi/afe/ir/transform/channel_scaling/index /pages/api_reference/python-autoapi/afe/ir/transform/compression_transforms/index /pages/api_reference/python-autoapi/afe/ir/transform/quantization_transforms/index /pages/api_reference/python-autoapi/afe/ir/transform/requantization_fusion/index /pages/api_reference/python-autoapi/afe/ir/transform/requantization_hoisting/index Classes ------- .. autoapisummary:: afe.ir.transform.Calibrate afe.ir.transform.InsertNodeObservers afe.ir.transform.RemoveNodeObservers afe.ir.transform.UpdateQuantizationConfigs afe.ir.transform.Quantize afe.ir.transform.Compress Package Contents ---------------- .. py:class:: Calibrate(length_hint: Optional[int], dataset: Iterable[Dict[str, numpy.ndarray]]) Calibrates an AwesomeNet. :param length_hint: If not None, gives the number of items in the data set. This is used for progress reporting and it does not affect the number of items used for calibration. :param dataset: The input data set for calibration. .. py:class:: InsertNodeObservers(calibration_method: afe.apis.defines.CalibrationMethod) Inserts NodeObservers into AwesomeNet's nodes. NodeObservers will not be added to nodes that don't use information obtained from calibration pass, but obtain quantization parameters based on the quantization parameters of its inputs. :param calibration_method: CalibrationMethod used in calibration. Determines the type of observers which shall be created. See CalibrationMethod Enum class for supported values. :param percentile_value: If the Histogram percentile is being used, percentage of values to keep. .. py:class:: RemoveNodeObservers Remove NodeObservers from AwesomeNet's nodes. This is needed in order to remove PyTorch infrastructure which is no longer needed from AwesomeNet's nodes. .. py:class:: UpdateQuantizationConfigs(quant_configs: afe.core.configs.QuantizationConfigs, custom_quantization_configs: Optional[Dict[afe.ir.defines.NodeName, Dict[str, Any]]] = None) Update quantization configs to each node in AwesomeNet :attribute asymmetry: bool. Set to True if users want to do asymmetry quantization for all layers or False for symmetric quantization unless some layers are specific configured in the custom_quantization_configs. :attribute per_channel: bool. Set to True if users want to do per-channel quantization for all layers or False for per-tensor quantization unless some layers are specific configured in the custom_quantization_configs. :attribute leaky_relu_uses_udf: Default is True. If Ture, AFE will use UDF for LeakyRelu operation. Else AFE will breakdown the LeakyRelu into multiple elementwise operationis unless some layers are specific configured in the custom_quantization_configs. :attribute custom_quantization_configs: Optional[Dict[NodeName, Dict[str, Any]]]. A dictionary using NodeName as keys. The value to each key is a dictionary of the AwesomeQuantAttr's field names and sets target configuration. Example ------- The example shows how a custom_quantization_configs looks like to config the output_int32 field in a Conv2DQuantAttrs in a output conv2d_add node to True. custom_quantization_configs = {"MLA_1/conv2d_add_84": {"output_int32": True}} .. py:class:: Quantize Quantizes an AwesomeNet .. py:class:: Compress Compresses an AwesomeNet