Skip to content
heliaAOT
API Reference
HELIA HUB

tensor

Machine-readable model

class

AirTensor

Python

AIR tensor representation.

helia_aot/air/tensor.py:48

AirTensor()

AIR tensor representation.

attribute

helia_aot/air/tensor.py:54

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

sparsity

Python

helia_aot/air/tensor.py:57

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

quant

Python

Quantization parameters, which must carry a scale.

helia_aot/air/tensor.py:186

quant: AirQuantizationParameters

Quantization parameters, which must carry a scale.

quantization is Optional so a tensor can carry none; kernels that require quantized inputs read through this view and get a typed error naming the tensor instead of an attribute access on None. A tensor with no scale, such as one with only a min/max range, is unquantized, as LiteRT’s kernels read it.

attribute

Whether kernels read this tensor through its quantization.

helia_aot/air/tensor.py:204

is_quantized: bool

Whether kernels read this tensor through its quantization.

Only an int8, uint8 or int16 tensor with a scale is. Any other tensor, such as a float tensor carrying a calibration range or a scale and zero point, is unquantized whatever it carries, as LiteRT’s kernels read it.

attribute

The stored value of a real 0: the first zero point of a quantized tensor, and 0 for any other.

helia_aot/air/tensor.py:215

stored_zero_point: int

The stored value of a real 0: the first zero point of a quantized tensor, and 0 for any other.

attribute

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

helia_aot/air/tensor.py:294

placement_id: TensorId

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

attribute

ctype

Python

Return the C type of the tensor.

helia_aot/air/tensor.py:303

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.

method

The zero point at index of a quantized tensor, and 0 for any other tensor or a missing entry.

helia_aot/air/tensor.py:224

quantized_zero_point(index: int = 0) -> int

The zero point at index of a quantized tensor, and 0 for any other tensor or a missing entry.

method

Reject a scale without a zero point, which LiteRT refuses to load whatever the dtype.

helia_aot/air/tensor.py:231

require_zero_point() -> None

Reject a scale without a zero point, which LiteRT refuses to load whatever the dtype.

Errors raised by require_zero_point
TypeDescription
MissingQuantizationErrorIf the tensor carries a scale and no zero point.
method

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

helia_aot/air/tensor.py:340

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

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

Errors raised by get_shape_nhwc
TypeDescription
ConfigValueErrorIf the tensor has more than four dimensions.