Skip to content
heliaEDGE
Reference
HELIA

spec

Typed export specification; importable without Keras or a training backend.

Machine-readable model

constant

VALID_IO

Python

helia_edge/export/spec.py:71

VALID_IO: dict[Precision, frozenset[IODType]] = {Precision.FP32: frozenset({IODType.FLOAT32}), Precision.FP16: frozenset({IODType.FLOAT16}), Precision.A8W8: frozenset({IODType.INT8, IODType.FLOAT32}), Precision.A16W8: frozenset({IODType.INT16, IODType.FLOAT32})}
class

Precision

Python

Numeric format of an exported graph.

helia_edge/export/spec.py:11

Precision()

Numeric format of an exported graph.

function

("in", k) or ("out", k) for a state tensor name, otherwise None.

helia_edge/export/spec.py:65

state_pair(name: str) -> tuple[str, int] | None

("in", k) or ("out", k) for a state tensor name, otherwise None.

class

What to export.

helia_edge/export/spec.py:81

ExportSpec()

What to export. precision, io_dtype and mode have no defaults.

attribute

strict

Python

helia_edge/export/spec.py:108

strict: StrictBool = True

For calibrated precisions, refuse operators without an integer kernel instead of falling back to float operators. Defaults to True; it does not affect float precisions.

attribute

helia_edge/export/spec.py:109

state_tie_tolerance: StrictFloat = Field(default=0.01, ge=0.0, le=0.5)

For calibrated precisions with integer I/O, export gives each state pair (state_in_k, state_out_k) one scale and zero point covering both tensors’ ranges, and refuses when that scale differs from either original by more than this fraction of it (at most 0.5). Models without state pairs ignore it.

attribute

helia_edge/export/spec.py:110

dense_per_channel: StrictBool = True

For calibrated precisions, quantize FULLY_CONNECTED weights per output channel (True, the converter’s default) or with one scale per tensor (False). Convolutions stay per channel either way. The CMSIS-NN int16 FULLY_CONNECTED kernel of LiteRT for Microcontrollers accepts per-tensor weights only, so a16w8 exports for it use False; the reference and heliaRT kernels run either. Float precisions refuse False.

function

Refuse per-tensor dense weights for a precision without quantized weights.

helia_edge/export/spec.py:124

check_dense_per_channel(precision: Precision, dense_per_channel: bool) -> None

Refuse per-tensor dense weights for a precision without quantized weights.

Errors raised by check_dense_per_channel
TypeDescription
ValueErrorIf ``dense_per_channel`` is False and ``precision`` is not a8w8 or a16w8.
class

The active Keras backend cannot export: LiteRT export needs the TensorFlow backend.

helia_edge/export/spec.py:134

BackendUnavailable()

The active Keras backend cannot export: LiteRT export needs the TensorFlow backend.

function

Refuse state resets that are not increasing steps from 1 to steps - 1 of a streaming model.

helia_edge/export/spec.py:138

check_resets(resets: Collection[int], steps: int, stateful: bool, what: str) -> None

Refuse state resets that are not increasing steps from 1 to steps - 1 of a streaming model.

Errors raised by check_resets
TypeDescription
ValueErrorIf ``resets`` are given for a model without state, or are not increasing steps within the sequence (step 0 always starts from zero states).