defines
Defines API
Classes:
-
ConvertArgs
–Available command line arguments
-
MemoryPlannerType
–Memory planner type
-
ModuleType
–Exported module type
-
MemoryPlacement
–Memory placement for tensors
-
OperatorAttributeRule
–Operator attribute rule set
-
OperatorAttributes
–Operator attributes
Copyright 2025 Ambiq. All Rights Reserved.
Classes
MemoryPlannerType
ModuleType
MemoryPlacement
ScratchMemoryPlacement
OperatorAttributeRule
This class defines a powerful and flexible way to customize the conversion process for specific operators in the LiteRT model.
Multiple attributes can be specified and allow slicing the model by operator type, operator identifier(s), or a specific combination of both.
The type
field can be a specific operator type (e.g., CONV_2D) or * for all operators.
The ident
field can be a specific operator identifier or a list of identifiers.
Since multiple attributes can be applied to the same operator, precedance is given based on the pair: 1. (1, 1) if both type and ident are specified and match 2. (1, 0) if type is specified and ident is not 3. (0, 1) if ident is specified and type is not 4. (0, 0) if neither is specified
Currently, if multiple attributes have the same precedence, the last one in the list will be used.
Attributes:
-
type
(str
) –The operator type (e.g. CONV_2D) or * for all.
-
ident
(int | list[int] | None
) –The operator identifier or list of identifiers.
-
attributes
(dict[str, BasicType]
) –A dictionary of operator attributes.
OperatorAttributes
This class provides the baseline set of operator attribute rules.
Additional rules are allowed due to the extra="allow"
setting.
A specific operator can optionally define its own subclass with additional rules and validation.
Attributes:
-
weights_memory
(MemoryPlacement
) –Memory placement for weights tensors (read-only)
-
scratch_memory
(ScratchMemoryPlacement
) –Scratch memory placement for tensors (read/write)
TransformsConfig
Load a YAML like:
transforms: "*": false # default for every transform FuseConvRelu: true # attribute for a single one
Any name not in TRANSFORM_REGISTRY is an error.
ConvertArgs
Conversion Arguments
This class provides the high-level arguments for the AOT conversion process.
Attributes:
-
path
(Path
) –Path to yaml configuration.
-
model_path
(Path
) –Path to liteRT file. Default is "model.tflite".
-
output_path
(Path
) –Base path for output module. Can also be a zip file. Default is "output.zip".
-
module_name
(str
) –Name used for module. Default is "helios_aot_nn".
-
module_type
(ModuleType
) –Module type (neuralspot or zephyr). Default is neuralspot.
-
prefix
(str
) –Prefix added to sources to provide unique namespace. Default is "aot".
-
memory_planner
(MemoryPlannerType
) –Memory planner strategy. Default is greedy.
-
operator_attributes
(list[OperatorAttributeRule]
) –Operator attributes. Default is empty list.
-
transforms
(TransformsConfig
) –Transforms configuration. Default is empty.
-
include_test
(bool
) –Include test case. Default is False.
-
subgraph
(int
) –Subgraph index. Default is 0.
-
model_version
(str
) –Model version. Default is "v1.0.0".
-
verbose
(int
) –Verbosity level. Default is 1.
-
log_file
(Path | None
) –Optional log file path. Default is None.