{
  "$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": "model",
      "path": "helia_aot.air.model",
      "submodules": [],
      "summary": "",
      "symbols": [
        {
          "description": "In-memory graph IR for AOT codegen.",
          "examples": [],
          "id": "helia_aot.air.model.AirModel",
          "kind": "class",
          "language": "python",
          "members": [
            {
              "description": "Name of the model.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.name",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "name",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "name: str = Field(default='Model', description='Name of the model')",
              "source": {
                "line": 22,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L22"
              },
              "summary": ""
            },
            {
              "description": "Version of the model.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.version",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "version",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "version: str = Field(default='1.0.0', description='Version of the model')",
              "source": {
                "line": 23,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L23"
              },
              "summary": ""
            },
            {
              "description": "Description of the model.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.description",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "description",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "description: str = Field(default='', description='Description of the model')",
              "source": {
                "line": 24,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L24"
              },
              "summary": ""
            },
            {
              "description": "Mapping from tensor ID to its AirTensor metadata.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.tensors",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "tensors",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "tensors: dict[str, AirTensor] = Field(default_factory=dict, description='Mapping from tensor ID to its AirTensor metadata')",
              "source": {
                "line": 25,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L25"
              },
              "summary": ""
            },
            {
              "description": "Topologically ordered list of operators (nodes) in the graph.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.operators",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "operators",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "operators: list[AirOperator] = Field(default_factory=list, description='Topologically ordered list of operators (nodes) in the graph')",
              "source": {
                "line": 28,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L28"
              },
              "summary": ""
            },
            {
              "description": "IDs of tensors that serve as model inputs.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.input_ids",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "input_ids",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "input_ids: list[str] = Field(default_factory=list, description='IDs of tensors that serve as model inputs')",
              "source": {
                "line": 31,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L31"
              },
              "summary": ""
            },
            {
              "description": "IDs of tensors that serve as model outputs.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.output_ids",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "output_ids",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "output_ids: list[str] = Field(default_factory=list, description='IDs of tensors that serve as model outputs')",
              "source": {
                "line": 32,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L32"
              },
              "summary": ""
            },
            {
              "description": "List of AirTensor objects corresponding to model inputs.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.inputs",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "inputs",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "inputs: list[AirTensor]",
              "source": {
                "line": 151,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L151"
              },
              "summary": "List of AirTensor objects corresponding to model inputs."
            },
            {
              "description": "List of AirTensor objects corresponding to model outputs.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.outputs",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "outputs",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "outputs: list[AirTensor]",
              "source": {
                "line": 156,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L156"
              },
              "summary": "List of AirTensor objects corresponding to model outputs."
            },
            {
              "description": "Register a new tensor in the model.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.add_tensor",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "add_tensor",
              "params": [],
              "raises": [
                {
                  "description": "If a tensor with the same ID already exists.",
                  "type": "ValueError"
                }
              ],
              "returns": [],
              "signature": "add_tensor(tensor: AirTensor) -> None",
              "source": {
                "line": 34,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L34"
              },
              "summary": "Register a new tensor in the model."
            },
            {
              "description": "Remove a tensor from the model by its ID.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.remove_tensor",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "remove_tensor",
              "params": [],
              "raises": [
                {
                  "description": "If the tensor ID is not found.",
                  "type": "KeyError"
                }
              ],
              "returns": [],
              "signature": "remove_tensor(tid: TensorId) -> None",
              "source": {
                "line": 44,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L44"
              },
              "summary": "Remove a tensor from the model by its ID."
            },
            {
              "description": "Append a new operator to the execution list.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.add_operator",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "add_operator",
              "params": [],
              "raises": [
                {
                  "description": "If an operator with the same ID already exists.",
                  "type": "ValueError"
                }
              ],
              "returns": [],
              "signature": "add_operator(op: AirOperator) -> None",
              "source": {
                "line": 55,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L55"
              },
              "summary": "Append a new operator to the execution list."
            },
            {
              "description": "Check if a tensor exists in the model by its ID.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.has_tensor",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "has_tensor",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "has_tensor(tid: TensorId) -> bool",
              "source": {
                "line": 65,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L65"
              },
              "summary": "Check if a tensor exists in the model by its ID."
            },
            {
              "description": "Lookup a tensor by its ID.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.get_tensor",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "get_tensor",
              "params": [],
              "raises": [
                {
                  "description": "If the tensor ID is not found.",
                  "type": "KeyError"
                }
              ],
              "returns": [],
              "signature": "get_tensor(tid: TensorId) -> AirTensor",
              "source": {
                "line": 69,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L69"
              },
              "summary": "Lookup a tensor by its ID."
            },
            {
              "description": "Whether anything other than ``reader`` uses tensor ``tid``.\n\nUses are other operators, aliases in either direction (following alias\nchains transitively), and the model's inputs and outputs. Rewriting a\ntensor in place is safe only when this is ``False``.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.tensor_is_shared",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "tensor_is_shared",
              "params": [
                {
                  "description": "The tensor to check.",
                  "name": "tid",
                  "type": "TensorId"
                },
                {
                  "default": "None",
                  "description": "The operator asking; its own references do not count.",
                  "name": "reader",
                  "type": "AirOperator | None"
                }
              ],
              "raises": [],
              "returns": [
                {
                  "description": "``True`` when some other use exists.",
                  "name": "bool",
                  "type": "bool"
                }
              ],
              "signature": "tensor_is_shared(tid: TensorId, reader: AirOperator | None = None) -> bool",
              "source": {
                "line": 90,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L90"
              },
              "summary": "Whether anything other than reader uses tensor tid."
            },
            {
              "description": "Bind ``reader``'s tensor ``name`` to ``data``, rewriting it only where that is safe.\n\nThe tensor is rewritten in place when nothing else uses it. Otherwise\n``reader`` is rebound to a copy under ``<id>_rewritten`` (or the first\nfree ``<id>_rewritten_N``) whose ``packed_from`` names the source, so\n``memory.tensors`` rules on the source id still place it.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.rewrite_constant",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "rewrite_constant",
              "params": [
                {
                  "description": "The operator that owns the rewrite.",
                  "name": "reader",
                  "type": "AirOperator"
                },
                {
                  "description": "Its local name for the tensor, or the tensor's position in its inputs.",
                  "name": "name",
                  "type": "str | int"
                },
                {
                  "description": "The rewritten data.",
                  "name": "data"
                }
              ],
              "raises": [],
              "returns": [
                {
                  "description": "The tensor ``reader`` now reads.",
                  "name": "AirTensor",
                  "type": "AirTensor"
                }
              ],
              "signature": "rewrite_constant(reader: AirOperator, name: str | int, data) -> AirTensor",
              "source": {
                "line": 110,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L110"
              },
              "summary": "Bind reader's tensor name to data, rewriting it only where that is safe."
            },
            {
              "description": "Return operators in execution order.\n\nAssumes `operators` was populated in valid topological order.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.topo_sort",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "topo_sort",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "topo_sort() -> list[AirOperator]",
              "source": {
                "line": 160,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L160"
              },
              "summary": "Return operators in execution order."
            },
            {
              "description": "Remove dangling tensors that are not referenced by any operator or model input/output.",
              "examples": [],
              "id": "helia_aot.air.model.AirModel.prune_unused_tensors",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "prune_unused_tensors",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "prune_unused_tensors() -> list[TensorId]",
              "source": {
                "line": 167,
                "path": "helia_aot/air/model.py",
                "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L167"
              },
              "summary": "Remove dangling tensors that are not referenced by any operator or model input/output."
            }
          ],
          "name": "AirModel",
          "params": [],
          "raises": [],
          "returns": [],
          "signature": "AirModel()",
          "source": {
            "line": 8,
            "path": "helia_aot/air/model.py",
            "url": "https://github.com/AmbiqAI/helia-aot/blob/cf2246a7ad439fa38d57462118e7840e5497a685/helia_aot/air/model.py#L8"
          },
          "summary": "In-memory graph IR for AOT codegen."
        }
      ]
    }
  ],
  "name": "helia_aot"
}
