defines
Classes
ModelArgs
Model configuration for the conversion process.
Attributes:
-
path(Path) –Path to the model file.
-
subgraph(int) –Subgraph index to process.
-
type(str | None) –Type of the model (e.g., tflite, litert)
-
name(str) –Name of the model.
-
description(str | None) –Optional description of the model.
-
version(str | None) –Version of the model.
ModuleArgs
Module configuration for the conversion process.
Attributes:
-
path(Path) –Output path for the generated module. Use a directory for an unpacked module, a
.zipsuffix for a generic zip archive, or a.packsuffix for an Open-CMSIS-Pack archive (requiresmodule.type=cmsis_pack). Defaults to"output.zip". -
type(ModuleType) –Type of the module (e.g., neuralspot, zephyr, cmake, nsx, cmsis_pack). Defaults to neuralspot.
-
name(ValidModuleNameType) –Name of the module. Defaults to "helia_aot_nn".
-
prefix(ValidCVarNameType) –Prefix added to sources for unique namespace. Defaults to "aot".
-
schedule(ScheduleMode) –Operator dispatch shape emitted into
<prefix>_model.c.table(default) keeps the runtime function-pointer table and per-node callback seam;staticemits straight-line direct calls. Defaults totable.
TestArgs
Test configuration for the conversion process.
Attributes:
-
enabled(bool) –Include test case. Defaults to False.
-
tolerance(float) –Test tolerance (integers are coerced). Defaults to 1.0.
-
skip_verification(bool) –Skip runtime output verification.
-
golden_data(Path | None) –Optional path to golden input/output npz file.
-
num_iterations(int) –Number of times to run the same stimulus through the model. Defaults to 1.
-
state_feedback(list[tuple[int, int]]) –(output_index, input_index)pairs copied back between iterations so recurrent state carries across invocations. Inputs named here are seeded from the stimulus only on the first iteration. Defaults to no feedback.
MemoryArgs
Memory configuration for the conversion process.
Attributes:
-
planner(MemoryPlannerType) –Memory planner strategy. Defaults to greedy.
-
constraints(list[MemoryConstraint] | None) –Memory constraints (ordered by preference). Defaults to None.
-
tensors(list[AttributeRuleset]) –Per-tensor attribute rulesets.
-
allocate_arenas(bool) –If true, generated module declares its own arena buffers.
-
auto_hydrate_constants(bool) –Deprecated — retained for backwards compatibility but no longer changes generated runtime behavior.
<prefix>_model_initalways invokes<prefix>_hydrate_constantsbetween<prefix>_context_initand the operator init loop, so kernels that read constants in their_inithook always observe hydrated arenas. Override the weak<prefix>_hydrate_constantssymbol for DMA / async pre-stage / model-swap behavior;model_initcalls the override at the same fixed point.
PlatformArgs
Platform configuration for the conversion process.
Attributes:
-
name(str) –Target platform name. Defaults to "apollo510_evb".
-
cpu(str | None) –CPU core type (e.g., cortex-m55). Optional for built-ins.
-
speeds(list[int]) –Supported clock speeds in MHz.
-
memories(dict[MemoryType, int]) –Memory sizes in bytes.
-
capabilities(list[SocCapability]) –Available SoC capabilities.
-
preferred_memory_order(list[MemoryType]) –Placement preference for planner.
-
min_alignment(int | None) –Minimum alignment in bytes.
DocumentationArgs
Documentation configuration for the generated module.
Attributes:
-
html(bool) –Generate html documentation site (experimental).
ConvertArgs
Configuration for the conversion process.
Attributes:
-
path(Path) –Path to yaml configuration.
-
model(ModelArgs) –Model configuration.
-
module(ModuleArgs) –Module configuration.
-
test(TestArgs) –Test configuration.
-
transforms(list[TransformSpec]) –Transforms configuration.
-
memory(MemoryArgs) –Memory configuration.
-
platform(PlatformArgs) –Target platform configuration.
-
verbose(int) –Verbosity level (0-3).
-
log_file(Path | None) –Optional log file path.
Functions
from_yaml
classmethod
Load a conversion config from a YAML file.
The canonical programmatic entry point mirroring the CLI's --path
(without the CLI's flag-override merge):
config = ConvertArgs.from_yaml("my-model.yaml")
AotConverter(config=config).convert()
Parameters:
Returns:
-
ConvertArgs–The validated configuration; unknown nested keys warn as usual.
Raises:
-
FileNotFoundError–If
pathdoes not exist. -
ValueError–If the file is not a YAML mapping.