# helia_aot.air.tensor

## helia_aot.air.tensor.TensorId

`attribute` · `python`

```python
TensorId = str
```

Source: `helia_aot/air/tensor.py:12`

## helia_aot.air.tensor.AirTensor

`class` · `python`

```python
AirTensor()
```

AIR tensor representation.

Source: `helia_aot/air/tensor.py:30`

### helia_aot.air.tensor.AirTensor.id

`attribute` · `python`

```python
id: TensorId = Field(..., description='Unique tensor identifier')
```

Source: `helia_aot/air/tensor.py:34`

### helia_aot.air.tensor.AirTensor.kind

`attribute` · `python`

```python
kind: AirTensorKind = Field(AirTensorKind.SCRATCH, description='The kind of tensor')
```

Source: `helia_aot/air/tensor.py:35`

### helia_aot.air.tensor.AirTensor.quantization

`attribute` · `python`

```python
quantization: AirQuantizationParameters | None = Field(default_factory=AirQuantizationParameters, description='Quantization parameters for the tensor')
```

Source: `helia_aot/air/tensor.py:36`

### helia_aot.air.tensor.AirTensor.sparsity

`attribute` · `python`

```python
sparsity: AirSparsityParameters | None = Field(default_factory=AirSparsityParameters, description='Sparsity parameters for the tensor')
```

Source: `helia_aot/air/tensor.py:39`

### helia_aot.air.tensor.AirTensor.buffer_index

`attribute` · `python`

```python
buffer_index: int | None = Field(None, description='Index of the buffer this tensor is mapped to')
```

Source: `helia_aot/air/tensor.py:52`

### helia_aot.air.tensor.AirTensor.local_name

`attribute` · `python`

```python
local_name: str | None = Field(None, description='Local name for the tensor')
```

Source: `helia_aot/air/tensor.py:53`

### helia_aot.air.tensor.AirTensor.shape_signature

`attribute` · `python`

```python
shape_signature: tuple[int, ...] | None = Field(None, description='Shape signature of the tensor')
```

Source: `helia_aot/air/tensor.py:54`

### helia_aot.air.tensor.AirTensor.has_rank

`attribute` · `python`

```python
has_rank: bool = Field(False, description='Indicates if the tensor has a rank')
```

Source: `helia_aot/air/tensor.py:55`

### helia_aot.air.tensor.AirTensor.alias_of

`attribute` · `python`

```python
alias_of: TensorId | None = Field(None, description='Optional alias for this tensor')
```

Source: `helia_aot/air/tensor.py:56`

### helia_aot.air.tensor.AirTensor.inferred_value

`attribute` · `python`

```python
inferred_value: Array | None = Field(default=None, repr=False, description='Compile-time value that shape propagation computed for a shape-expression tensor: the output of a SHAPE, or of a STRIDED_SLICE or PACK over one. An operator still produces the tensor at run time, so this is not constant data; code that needs a constant reads `data`. FoldStaticShapeExpressions moves the value into `data` and removes the producing operator.')
```

Source: `helia_aot/air/tensor.py:57`

### helia_aot.air.tensor.AirTensor.alignment_hint

`attribute` · `python`

```python
alignment_hint: int | None = Field(None, description='Alignment hint for the tensor in bytes')
```

Source: `helia_aot/air/tensor.py:67`

### helia_aot.air.tensor.AirTensor.fixed_offset

`attribute` · `python`

```python
fixed_offset: int | None = Field(None, description="Mandatory arena-relative byte offset imposed by an external compiler (e.g. Vela's OfflineMemoryAllocation for an Ethos-U subgraph). When set, the memory planner must place this tensor at exactly this offset within its writable arena instead of choosing one, because the offset is baked into a command stream. Such tensors may intentionally overlap one another.")
```

Source: `helia_aot/air/tensor.py:68`

### helia_aot.air.tensor.AirTensor.packed_from

`attribute` · `python`

```python
packed_from: TensorId | None = Field(None, description='Id of the tensor whose data a conversion-time repacking produced this one from. memory.tensors rules resolve against that id (see placement_id).')
```

Source: `helia_aot/air/tensor.py:78`

### helia_aot.air.tensor.AirTensor.layout

`attribute` · `python`

```python
layout: str | None = Field(None, description='Weight layout of repacked data, e.g. NT_N_PACKED')
```

Source: `helia_aot/air/tensor.py:85`

### helia_aot.air.tensor.AirTensor.shape

`attribute` · `python`

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

Source: `helia_aot/air/tensor.py:102`

### helia_aot.air.tensor.AirTensor.dtype

`attribute` · `python`

```python
dtype: np.dtype
```

Source: `helia_aot/air/tensor.py:121`

### helia_aot.air.tensor.AirTensor.data

`attribute` · `python`

```python
data: npt.NDArray | None
```

Return the data of the tensor.

Source: `helia_aot/air/tensor.py:136`

### helia_aot.air.tensor.AirTensor.quant

`attribute` · `python`

```python
quant: AirQuantizationParameters
```

Quantization parameters, which must be present.

``quantization`` is Optional so a tensor can carry none; kernels that
require quantized inputs read through this view and get a clear error
naming the tensor instead of an attribute access on ``None``.

Source: `helia_aot/air/tensor.py:154`

### helia_aot.air.tensor.AirTensor.size

`attribute` · `python`

```python
size: int
```

Return the size of the tensor.

Source: `helia_aot/air/tensor.py:166`

### helia_aot.air.tensor.AirTensor.nbytes

`attribute` · `python`

```python
nbytes: int
```

Return the number of bytes in the tensor.

Source: `helia_aot/air/tensor.py:177`

### helia_aot.air.tensor.AirTensor.ndim

`attribute` · `python`

```python
ndim: int
```

Return the number of dimensions of the tensor.

Source: `helia_aot/air/tensor.py:186`

### helia_aot.air.tensor.AirTensor.is_constant

`attribute` · `python`

```python
is_constant: bool
```

Check if the tensor is a constant.

Source: `helia_aot/air/tensor.py:191`

### helia_aot.air.tensor.AirTensor.is_persistent

`attribute` · `python`

```python
is_persistent: bool
```

Check if the tensor is a persistent variable.

Source: `helia_aot/air/tensor.py:196`

### helia_aot.air.tensor.AirTensor.is_scratch

`attribute` · `python`

```python
is_scratch: bool
```

Check if the tensor is a scratch tensor.

Source: `helia_aot/air/tensor.py:201`

### helia_aot.air.tensor.AirTensor.placement_id

`attribute` · `python`

```python
placement_id: TensorId
```

Id that ``memory.tensors`` rules match: the source id for a repacked copy.

Source: `helia_aot/air/tensor.py:206`

### helia_aot.air.tensor.AirTensor.name

`attribute` · `python`

```python
name: str
```

Source: `helia_aot/air/tensor.py:211`

### helia_aot.air.tensor.AirTensor.ctype

`attribute` · `python`

```python
ctype: str
```

Return the C type of the tensor.

This is used for generating C code that operates on the tensor.
For example, if the tensor is of type int16, the C type will be int16_t.

Source: `helia_aot/air/tensor.py:215`

### helia_aot.air.tensor.AirTensor.dtype_alignment_floor

`attribute` · `python`

```python
dtype_alignment_floor: int
```

Return the alignment floor based on the tensor's dtype.

Source: `helia_aot/air/tensor.py:248`

### helia_aot.air.tensor.AirTensor.get_shape_nhwc

`method` · `python`

```python
get_shape_nhwc(pre: bool = True) -> tuple[int, int, int, int]
```

Return a NHWC padded shape tuple, padding missing axes with 1.

Source: `helia_aot/air/tensor.py:252`

### helia_aot.air.tensor.AirTensor.get_shape_with_axis_expanded

`method` · `python`

```python
get_shape_with_axis_expanded(axis: int) -> tuple[int, ...]
```

Source: `helia_aot/air/tensor.py:264`
