{
  "$schema": "https://ambiqai.github.io/helia-ui/schema/reference-model-1.json",
  "generatedFrom": {
    "sourceCommit": "cf2246a7ad439fa38d57462118e7840e5497a685",
    "tool": "pyref",
    "version": "1.7.3"
  },
  "language": "python",
  "modules": [
    {
      "description": "",
      "name": "utils",
      "path": "helia_aot.air.utils",
      "submodules": [],
      "summary": "",
      "symbols": [
        {
          "description": "Convert a floating point multiplier into a fixed-point multiplier and shift.\n\nGiven a real multiplier, this function computes a pair (quantized_multiplier, shift)\nsuch that the fixed-point multiplication approximates the real multiplier:\n\n    real_multiplier ~ quantized_multiplier / (2^(31 - shift))\n\nThis is typically used in quantized inference to convert floating-point scaling\nfactors to fixed-point representation.\n\nThe CMSIS-NN ``arm_nn_divide_by_power_of_two`` function only supports\nexponent values in [0, 31], so the resulting shift is clamped to [-31, 30].\nWhen the real multiplier is so small that the shift would fall below -31\nthe contribution is negligible and the multiplier is flushed to zero.",
          "examples": [],
          "id": "helia_aot.air.utils.quantize_multiplier",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "quantize_multiplier",
          "params": [
            {
              "description": "The floating-point multiplier.",
              "name": "real_multiplier",
              "type": "float"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "(quantized_multiplier, shift)",
              "name": "tuple",
              "type": "tuple[int, int]"
            }
          ],
          "signature": "quantize_multiplier(real_multiplier: float) -> tuple[int, int]",
          "source": {
            "line": 8,
            "path": "helia_aot/air/utils.py",
            "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/utils.py#L8"
          },
          "summary": "Convert a floating point multiplier into a fixed-point multiplier and shift."
        },
        {
          "description": "Compute the activation min and max values based on the fused activation function.",
          "examples": [],
          "id": "helia_aot.air.utils.compute_fused_activation_range",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "compute_fused_activation_range",
          "params": [
            {
              "description": "The activation function type.",
              "name": "activation_function",
              "type": "litert.ActivationFunctionType"
            },
            {
              "default": "0",
              "description": "The zero point for the output tensor. Defaults to 0.",
              "name": "output_zero_point",
              "type": "int"
            },
            {
              "default": "1.0",
              "description": "The scale for the output tensor. Defaults to 1.0.",
              "name": "output_scale",
              "type": "float"
            },
            {
              "default": "-128",
              "description": "Minimum quantized value. Defaults to -128.",
              "name": "qmin",
              "type": "int"
            },
            {
              "default": "127",
              "description": "Maximum quantized value. Defaults to 127.",
              "name": "qmax",
              "type": "int"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "tuple[int, int]: The activation min and max values.",
              "type": "tuple[int, int]"
            }
          ],
          "signature": "compute_fused_activation_range(\n    activation_function: AirActivationType,\n    output_zero_point: int = 0,\n    output_scale: float = 1.0,\n    qmin: int = -128,\n    qmax: int = 127,\n) -> tuple[int, int]",
          "source": {
            "line": 68,
            "path": "helia_aot/air/utils.py",
            "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/utils.py#L68"
          },
          "summary": "Compute the activation min and max values based on the fused activation function."
        },
        {
          "description": "Computes a single padding value (top/left) for one dimension with offset.",
          "examples": [],
          "id": "helia_aot.air.utils.compute_padding_with_offset",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "compute_padding_with_offset",
          "params": [
            {
              "description": "Input dimension (height or width).",
              "name": "in_size",
              "type": "int"
            },
            {
              "description": "Kernel dimension (height or width).",
              "name": "filter_size",
              "type": "int"
            },
            {
              "description": "Stride for that dimension.",
              "name": "stride",
              "type": "int"
            },
            {
              "default": "1",
              "description": "Dilation rate for that dimension (default is 1).",
              "name": "dilation_rate",
              "type": "int"
            },
            {
              "default": "AirPaddingType.SAME",
              "description": "0 for SAME padding, 1 for VALID padding (default is SAME).",
              "name": "padding_type",
              "type": "int"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "The computed top or left padding value.",
              "name": "int",
              "type": "tuple[int, int]"
            }
          ],
          "signature": "compute_padding_with_offset(\n    in_size: int,\n    filter_size: int,\n    stride: int,\n    dilation_rate: int = 1,\n    padding_type: int = AirPaddingType.SAME,\n) -> tuple[int, int]",
          "source": {
            "line": 111,
            "path": "helia_aot/air/utils.py",
            "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/utils.py#L111"
          },
          "summary": "Computes a single padding value (top/left) for one dimension with offset."
        },
        {
          "description": "Computes a single padding value (top/left) for one dimension.",
          "examples": [],
          "id": "helia_aot.air.utils.compute_padding",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "compute_padding",
          "params": [
            {
              "description": "Input dimension (height or width).",
              "name": "in_size",
              "type": "int"
            },
            {
              "description": "Kernel dimension (height or width).",
              "name": "filter_size",
              "type": "int"
            },
            {
              "description": "Stride for that dimension.",
              "name": "stride",
              "type": "int"
            },
            {
              "default": "1",
              "description": "Dilation rate for that dimension (default is 1).",
              "name": "dilation_rate",
              "type": "int"
            },
            {
              "default": "AirPaddingType.SAME",
              "description": "0 for SAME padding, 1 for VALID padding (default is SAME).",
              "name": "padding_type",
              "type": "int"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "The computed top or left padding value.",
              "name": "int",
              "type": "int"
            }
          ],
          "signature": "compute_padding(\n    in_size: int,\n    filter_size: int,\n    stride: int,\n    dilation_rate: int = 1,\n    padding_type: int = AirPaddingType.SAME,\n) -> int",
          "source": {
            "line": 140,
            "path": "helia_aot/air/utils.py",
            "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/utils.py#L140"
          },
          "summary": "Computes a single padding value (top/left) for one dimension."
        },
        {
          "description": "Reduce a multiplier value for int16 quantization.\n\nCertain CMSIS functions for int16 quantized models require the\nmultiplier to be reduced from Q31 format to Q15 format. This function\nperforms that reduction.",
          "examples": [],
          "id": "helia_aot.air.utils.reduce_multiplier_q31_to_q15",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "reduce_multiplier_q31_to_q15",
          "params": [
            {
              "description": "The original multiplier value.",
              "name": "multiplier",
              "type": "int"
            }
          ],
          "raises": [],
          "returns": [
            {
              "description": "The reduced multiplier value.",
              "name": "int",
              "type": "int"
            }
          ],
          "signature": "reduce_multiplier_q31_to_q15(multiplier: int) -> int",
          "source": {
            "line": 185,
            "path": "helia_aot/air/utils.py",
            "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/utils.py#L185"
          },
          "summary": "Reduce a multiplier value for int16 quantization."
        }
      ]
    }
  ],
  "name": "helia_aot"
}
