# helia_aot.views

Read-only views of what a conversion generated.

``ConvertArgs.result_views`` asks ``AotConverter.convert()`` to fill
``ConversionResult.operators``, ``tensors``, ``regions`` and ``placements``
with the frozen records below. They describe the generated module, not the
graph, memory plan and operator objects the converter works with, which stay
internal and can change in any release.

**Classes**

| Name | Description |
| --- | --- |
| `OperatorView` | One generated operator. |
| `QuantizationView` | A tensor's quantization parameters. |
| `TensorView` | One tensor of the generated module. |
| `RegionView` | One arena region of the generated module. |
| `PlacementView` | Where one tensor lives. |

Copyright 2025 Ambiq. All Rights Reserved.

## helia_aot.views.OperatorView

`class` · `python`

```python
OperatorView(
    layer_index: int,
    symbol: str,
    type: str,
    source_indices: tuple[int, ...],
    input_ids: tuple[str, ...],
    output_ids: tuple[str, ...],
    local_tensor_ids: tuple[str, ...],
    kernel_calls: Mapping[str, str] | None,
    macs: int | None,
    parameters: int | None,
) -> None
```

`dataclass`

One generated operator, as ``ConversionResult.operators`` lists them in execution order.

With ``module.schedule: table``, the generated operator callback reports
``run_started`` and ``run_finished`` for the operators in this order, and
its ``op`` argument is the operator's ``layer_index``.

Source: `helia_aot/views.py:82`

### helia_aot.views.OperatorView.layer_index

`attribute` · `python`

```python
layer_index: int
```

The operator's position in execution order, from 0; its
index in ``ConversionResult.operators``.

Source: `helia_aot/views.py:139`

### helia_aot.views.OperatorView.symbol

`attribute` · `python`

```python
symbol: str
```

The name the operator's generated code is built from,
``<prefix>_<type>_<id>``: its ``_init`` and ``_run`` functions,
where the module emits them, and its source files.

Source: `helia_aot/views.py:140`

### helia_aot.views.OperatorView.type

`attribute` · `python`

```python
type: str
```

The operator type: the name of its operator in the model file,
a LiteRT builtin operator name such as ``CONV_2D`` or ``LESS``, or
a custom operator's canonical key. A transform that rewrites an
operator reports the type it generates, so a depthwise convolution
that ``DEPTHWISE_TO_CONV`` rewrites is ``CONV_2D``.

Source: `helia_aot/views.py:141`

### helia_aot.views.OperatorView.source_indices

`attribute` · `python`

```python
source_indices: tuple[int, ...]
```

The index of the operator in the model file that the
operator was parsed from, in the converted subgraph. A fused
activation is part of its LiteRT operator and adds no index. A
transform that rewrites an operator keeps its index; an operator a
transform removes, as ``FOLD_STATIC_SHAPE_EXPRESSIONS`` removes
shape arithmetic, appears in no entry, and one a transform creates
has none. A LiteRT model hook that reorders the subgraph or
returns a copy of the model keeps every index. An operator a hook
creates lists the indices the hook states for it: each rolled-GRU
fusion states its own ``WHILE`` loop and the reshapes around it.
An operator a hook creates without stating any, or rebuilds from
the serialized model, has none.

Source: `helia_aot/views.py:142`

### helia_aot.views.OperatorView.input_ids

`attribute` · `python`

```python
input_ids: tuple[str, ...]
```

The ids of the tensors the operator reads, in operand order.

Source: `helia_aot/views.py:143`

### helia_aot.views.OperatorView.output_ids

`attribute` · `python`

```python
output_ids: tuple[str, ...]
```

The ids of the tensors the operator writes, in operand order.

Source: `helia_aot/views.py:144`

### helia_aot.views.OperatorView.local_tensor_ids

`attribute` · `python`

```python
local_tensor_ids: tuple[str, ...]
```

The ids of the operator's own tensors, as lowered:
weights, biases, quantization parameters, precomputed sums and
scratch buffers. Each id appears once and none is in ``input_ids``
or ``output_ids``; the order is not promised.

Source: `helia_aot/views.py:145`

### helia_aot.views.OperatorView.kernel_calls

`attribute` · `python`

```python
kernel_calls: Mapping[str, str] | None
```

Each heliaCORE function the operator's generated code
calls, keyed by its role, such as ``run``; empty for an operator
that calls none, or ``None`` when the operator does not record its
calls.

Source: `helia_aot/views.py:146`

### helia_aot.views.OperatorView.macs

`attribute` · `python`

```python
macs: int | None
```

Multiply-accumulates per inference, a fused activation not
counted, or ``None`` for an operator type with no defined count:
``CONV_2D``, ``DEPTHWISE_CONV_2D`` and ``FULLY_CONNECTED`` count
one per weight for each output row (the output's elements over its
last dimension), padded positions included; ``TRANSPOSE_CONV``,
and a ``CONV_2D`` rewritten from one, one per weight for each
input row; ``BATCH_MATMUL`` one per output element for each
element of the contracted dimension; ``AVERAGE_POOL_2D`` and
``MAX_POOL_2D`` count 0; every other type is ``None``.

Source: `helia_aot/views.py:147`

### helia_aot.views.OperatorView.parameters

`attribute` · `python`

```python
parameters: int | None
```

The elements of the operator's constant weights and bias
(a ``BATCH_MATMUL``'s constant operands), as the model holds them
before lowering repacks or folds them, a weight a ``DEQUANTIZE``
of a constant produces counted as that constant; ``None`` where
``macs`` is, and 0 for the pooling types.

Source: `helia_aot/views.py:148`

## helia_aot.views.QuantizationView

`class` · `python`

```python
QuantizationView(scale: tuple[float, ...], zero_point: tuple[int, ...], axis: int) -> None
```

`dataclass`

A tensor's quantization parameters: ``real = (q - zero_point) * scale``.

Source: `helia_aot/views.py:151`

### helia_aot.views.QuantizationView.scale

`attribute` · `python`

```python
scale: tuple[float, ...]
```

One scale per tensor, or one per channel along ``axis``.

Source: `helia_aot/views.py:161`

### helia_aot.views.QuantizationView.zero_point

`attribute` · `python`

```python
zero_point: tuple[int, ...]
```

The zero points, one per scale; empty when the model gives none.

Source: `helia_aot/views.py:162`

### helia_aot.views.QuantizationView.axis

`attribute` · `python`

```python
axis: int
```

The channel axis of per-channel parameters.

Source: `helia_aot/views.py:163`

## helia_aot.views.TensorView

`class` · `python`

```python
TensorView(
    id: str,
    name: str | None,
    shape: tuple[int, ...],
    dtype: str,
    ctype: str,
    quantization: QuantizationView | None,
    kind: TensorKind,
    input_index: int | None,
    output_index: int | None,
    nbytes: int,
) -> None
```

`dataclass`

One tensor of the generated module, as ``ConversionResult.tensors`` lists them.

The list follows the generated tensor enumeration: the tensor at index
``i`` is the one the module's ``<prefix>_tensor_ident_t`` numbers ``i``.

Source: `helia_aot/views.py:166`

### helia_aot.views.TensorView.id

`attribute` · `python`

```python
id: str
```

The tensor's id, the key of ``ConversionResult.placements``.

Source: `helia_aot/views.py:192`

### helia_aot.views.TensorView.name

`attribute` · `python`

```python
name: str | None
```

The model's name for the tensor, or ``None`` for an unnamed one
or one the conversion created.

Source: `helia_aot/views.py:193`

### helia_aot.views.TensorView.shape

`attribute` · `python`

```python
shape: tuple[int, ...]
```

The tensor's shape.

Source: `helia_aot/views.py:194`

### helia_aot.views.TensorView.dtype

`attribute` · `python`

```python
dtype: str
```

The element type's NumPy name, such as ``int8``.

Source: `helia_aot/views.py:195`

### helia_aot.views.TensorView.ctype

`attribute` · `python`

```python
ctype: str
```

The C element type the generated code holds it as, such as ``int8_t``.

Source: `helia_aot/views.py:196`

### helia_aot.views.TensorView.quantization

`attribute` · `python`

```python
quantization: QuantizationView | None
```

Its quantization parameters, or ``None`` when it carries no scale.

Source: `helia_aot/views.py:197`

### helia_aot.views.TensorView.kind

`attribute` · `python`

```python
kind: TensorKind
```

``input`` for a model input, otherwise ``output`` for a model
output, otherwise ``constant``, ``persistent`` or ``scratch``. A
tensor that is both a model input and a model output is ``input``;
``input_index`` and ``output_index`` carry both roles.

Source: `helia_aot/views.py:198`

### helia_aot.views.TensorView.input_index

`attribute` · `python`

```python
input_index: int | None
```

The tensor's position in the module's inputs, the index
of ``<prefix>_inputs_id`` and ``ctx->inputs`` it fills, or ``None``.

Source: `helia_aot/views.py:199`

### helia_aot.views.TensorView.output_index

`attribute` · `python`

```python
output_index: int | None
```

The tensor's position in the module's outputs, the index
of ``<prefix>_outputs_id`` and ``ctx->outputs``, or ``None``.

Source: `helia_aot/views.py:200`

### helia_aot.views.TensorView.nbytes

`attribute` · `python`

```python
nbytes: int
```

The bytes the memory plan allocated for it.

Source: `helia_aot/views.py:201`

## helia_aot.views.RegionView

`class` · `python`

```python
RegionView(
    id: int,
    memory: MemoryType,
    source_memory: MemoryType,
    role: RegionRole,
    offset: int,
    size: int,
    alignment: int,
    symbol: str | None,
    source_symbol: str | None,
    source_offset: int,
    sidecar_file: str | None,
) -> None
```

`dataclass`

One arena region of the generated module, as ``ConversionResult.regions`` lists them.

The region at index ``i`` has ``id == i``, the value of its enumerator in
the module's ``<prefix>_arena_region_t``, which ``<prefix>_bind_arena``
takes and the residency report's ``region_id`` uses.

Source: `helia_aot/views.py:204`

### helia_aot.views.RegionView.id

`attribute` · `python`

```python
id: int
```

The region's enumerator value, from 0.

Source: `helia_aot/views.py:236`

### helia_aot.views.RegionView.memory

`attribute` · `python`

```python
memory: MemoryType
```

The memory the operators read and write the region in.

Source: `helia_aot/views.py:237`

### helia_aot.views.RegionView.source_memory

`attribute` · `python`

```python
source_memory: MemoryType
```

The memory a staged constant region is copied from at
initialization; ``memory`` for every other region.

Source: `helia_aot/views.py:238`

### helia_aot.views.RegionView.role

`attribute` · `python`

```python
role: RegionRole
```

``scratch``, ``persistent`` or ``constant``.

Source: `helia_aot/views.py:239`

### helia_aot.views.RegionView.offset

`attribute` · `python`

```python
offset: int
```

The bytes from ``symbol`` to the region's first usable byte:
an address-zero guard ahead of a generated ITCM region, otherwise 0.

Source: `helia_aot/views.py:240`

### helia_aot.views.RegionView.size

`attribute` · `python`

```python
size: int
```

The region's usable bytes.

Source: `helia_aot/views.py:241`

### helia_aot.views.RegionView.alignment

`attribute` · `python`

```python
alignment: int
```

The alignment of its first usable byte, in bytes.

Source: `helia_aot/views.py:242`

### helia_aot.views.RegionView.symbol

`attribute` · `python`

```python
symbol: str | None
```

The C object the module emits for the region, or ``None``
when the application binds it (``memory.allocate_arenas: false``).

Source: `helia_aot/views.py:243`

### helia_aot.views.RegionView.source_symbol

`attribute` · `python`

```python
source_symbol: str | None
```

The C object holding a staged constant region's bytes
before they are copied, emitted in both arena modes, or ``None``.

Source: `helia_aot/views.py:244`

### helia_aot.views.RegionView.source_offset

`attribute` · `python`

```python
source_offset: int
```

The bytes from ``source_symbol`` to the first of those
bytes: an address-zero guard ahead of a source in ITCM, otherwise 0.

Source: `helia_aot/views.py:245`

### helia_aot.views.RegionView.sidecar_file

`attribute` · `python`

```python
sidecar_file: str | None
```

The file, relative to the module directory, the module
writes a constant region's ``size`` bytes to when
``memory.allocate_arenas`` is false, or ``None``. It holds the
data only, never an address-zero guard. A cold constant region is
bound to these bytes; a staged one is copied at initialization
from ``source_symbol``, whose data are the same bytes.

Source: `helia_aot/views.py:246`

## helia_aot.views.PlacementView

`class` · `python`

```python
PlacementView(region: int | None, offset: int, size: int, source_memory: MemoryType, staged: bool) -> None
```

`dataclass`

Where one tensor lives, as ``ConversionResult.placements`` maps them by tensor id.

Source: `helia_aot/views.py:249`

### helia_aot.views.PlacementView.region

`attribute` · `python`

```python
region: int | None
```

The ``RegionView.id`` of the region holding the tensor, or
``None`` for a tensor with no elements, which has no region.

Source: `helia_aot/views.py:264`

### helia_aot.views.PlacementView.offset

`attribute` · `python`

```python
offset: int
```

The tensor's byte offset in the region.

Source: `helia_aot/views.py:265`

### helia_aot.views.PlacementView.size

`attribute` · `python`

```python
size: int
```

The bytes allocated for it.

Source: `helia_aot/views.py:266`

### helia_aot.views.PlacementView.source_memory

`attribute` · `python`

```python
source_memory: MemoryType
```

The memory its bytes are copied from when staged,
otherwise its region's memory.

Source: `helia_aot/views.py:267`

### helia_aot.views.PlacementView.staged

`attribute` · `python`

```python
staged: bool
```

Whether it is a constant copied into its region at
initialization.

Source: `helia_aot/views.py:268`
