{
  "$schema": "https://ambiqai.github.io/helia-ui/schema/reference-model-1.json",
  "generatedFrom": {
    "sourceCommit": "f341fb11f7f5d77a4974ba8273c4cd55d67c21f0",
    "tool": "pyref",
    "version": "1.7.3"
  },
  "language": "python",
  "modules": [
    {
      "description": "LiteRT (.tflite) conversion on the TensorFlow backend.",
      "name": "litert",
      "path": "helia_edge.export.litert",
      "submodules": [],
      "summary": "LiteRT (.tflite) conversion on the TensorFlow backend.",
      "symbols": [
        {
          "description": "Convert a Keras model to LiteRT bytes; ``export_model`` validates the arguments first.\n\nA model with state inputs is converted with its outputs keyed by output name, so the signature names\n``state_in_k`` and ``state_out_k``.",
          "examples": [],
          "id": "helia_edge.export.litert.convert_litert",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "convert_litert",
          "params": [
            {
              "description": "The Keras model, on the TensorFlow backend.",
              "name": "model",
              "type": "keras.Model"
            },
            {
              "description": "The numeric format; FP16 is TensorFlow's float16 weight storage rewritten to a native\nfloat16 graph (``to_native_fp16``).",
              "name": "precision",
              "type": "Precision"
            },
            {
              "description": "Inputs and outputs of the calibrated precisions. FP32 graphs have float32 and FP16 graphs\nfloat16 inputs and outputs whatever ``io_dtype`` says, so pass those.",
              "name": "io_dtype",
              "type": "IODType"
            },
            {
              "description": "How the model is traced; SAVED_MODEL exports to a temporary directory removed after conversion.",
              "name": "mode",
              "type": "ConversionMode"
            },
            {
              "description": "For calibrated precisions, refuse operators without an integer kernel.",
              "name": "strict",
              "type": "bool"
            },
            {
              "description": "Samples for the calibrated precisions, used one at a time in stored order; for a model\nwith several inputs, a mapping of each input name to its samples, fed by name because the\nconverter orders inputs its own way.",
              "name": "calibration",
              "type": "npt.NDArray | Mapping[str, npt.NDArray] | None"
            }
          ],
          "raises": [
            {
              "description": "If ``mode`` is CONCRETE and the model has several inputs or state inputs: a concrete\nfunction converts to a graph without a signature, which name-keyed calibration and state\ntensors need. Also if a model with state inputs repeats an output name, as two outputs of one\nlayer do.",
              "type": "ValueError"
            }
          ],
          "returns": [
            {
              "description": "The LiteRT flatbuffer.",
              "name": "bytes",
              "type": "bytes"
            }
          ],
          "signature": "convert_litert(\n    model: keras.Model,\n    *,\n    precision: Precision,\n    io_dtype: IODType,\n    mode: ConversionMode,\n    strict: bool,\n    calibration: npt.NDArray | Mapping[str, npt.NDArray] | None,\n) -> bytes",
          "source": {
            "line": 27,
            "path": "helia_edge/export/litert.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/export/litert.py#L27"
          },
          "summary": "Convert a Keras model to LiteRT bytes; exportmodel validates the arguments first."
        },
        {
          "description": "Read the main subgraph's input and output tensors from a ``.tflite`` flatbuffer.\n\nInputs and outputs are in subgraph order. Tensors whose signature names are ``state_in_k`` and\n``state_out_k``, with equal shapes and types, are STATE tensors of pair ``k``; the others, including\nunpaired state names of an imported model, are SIGNAL tensors.",
          "examples": [],
          "id": "helia_edge.export.litert.tensor_records",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "tensor_records",
          "params": [],
          "raises": [],
          "returns": [],
          "signature": "tensor_records(content: bytes) -> tuple[tuple[TensorRecord, ...], tuple[TensorRecord, ...]]",
          "source": {
            "line": 183,
            "path": "helia_edge/export/litert.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/export/litert.py#L183"
          },
          "summary": "Read the main subgraph's input and output tensors from a .tflite flatbuffer."
        },
        {
          "description": "Builtin operator names of every subgraph's operators, in execution order.",
          "examples": [],
          "id": "helia_edge.export.litert.operator_names",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "operator_names",
          "params": [],
          "raises": [],
          "returns": [],
          "signature": "operator_names(content: bytes) -> list[str]",
          "source": {
            "line": 228,
            "path": "helia_edge/export/litert.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/export/litert.py#L228"
          },
          "summary": "Builtin operator names of every subgraph's operators, in execution order."
        },
        {
          "description": "Give both tensors of each integer state pair one scale and zero point.\n\nA runtime carries ``state_out_k`` back into ``state_in_k`` as raw integers, which keeps the state's\nvalue only if both tensors have the same quantization. For each pair whose parameters differ, both\ntensors take the parameters of the tensor whose range covers the other's (the larger scale of a\nsymmetric int16 pair), or else parameters whose range covers both ranges. The kernels reading or\nwriting either tensor recompute their scaling from the new parameters when prepared, and the bias\nof a FULLY_CONNECTED or convolution reading a state tensor is requantized to its new input scale. A\nRESHAPE or SQUEEZE reading a state tensor copies its bytes, so its output takes the same parameters,\nand its own readers are checked and requantized in turn.",
          "examples": [],
          "id": "helia_edge.export.litert.tie_state_scales",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "tie_state_scales",
          "params": [
            {
              "description": "Calibrated ``.tflite`` flatbuffer.",
              "name": "content",
              "type": "bytes"
            },
            {
              "description": "Largest difference between the tied scale and either original scale, relative to that\noriginal.",
              "name": "tolerance",
              "type": "float"
            }
          ],
          "raises": [
            {
              "description": "If state names do not pair up or a pair's tensors differ in shape or type, a pair mixes\nfloat and integer quantization, the tied scale differs from an original scale by more than\n``tolerance``, an operator that reads or writes a state tensor needs its parameters unchanged,\nor a state tensor is a reader's weight or bias, or a reader's bias cannot be requantized\n(shared, of an unexpected type or scale count, or overflowing).",
              "type": "ValueError"
            }
          ],
          "returns": [
            {
              "description": "``content`` itself when every pair is already tied or float; otherwise the rewritten model.",
              "name": "bytes",
              "type": "bytes"
            }
          ],
          "signature": "tie_state_scales(content: bytes, tolerance: float) -> bytes",
          "source": {
            "line": 360,
            "path": "helia_edge/export/litert.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/export/litert.py#L360"
          },
          "summary": "Give both tensors of each integer state pair one scale and zero point."
        },
        {
          "description": "Export with an already validated spec and calibration array.",
          "examples": [],
          "id": "helia_edge.export.litert.export_litert",
          "kind": "function",
          "language": "python",
          "members": [],
          "name": "export_litert",
          "params": [],
          "raises": [],
          "returns": [],
          "signature": "export_litert(\n    model: keras.Model,\n    spec: ExportSpec,\n    calibration: npt.NDArray | Mapping[str, npt.NDArray] | None,\n) -> ExportResult",
          "source": {
            "line": 424,
            "path": "helia_edge/export/litert.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/export/litert.py#L424"
          },
          "summary": "Export with an already validated spec and calibration array."
        }
      ]
    }
  ],
  "name": "helia_edge"
}
