Skip to content

defines

Defines API

Classes:

  • ModuleType

    Enum representing the type of exported module.

Copyright 2025 Ambiq. All Rights Reserved.

Classes

AnyCaseStrEnum

Case-insensitive string enumeration.

This is useful for parsing user input in a flexible manner.

LowerCaseStrEnum

Lowercase string enumeration.

UpperCaseStrEnum

Uppercase string enumeration.

ModuleType

Exported module type

Attributes:

  • neuralspot (str) –

    NeuralSpot module

  • zephyr (str) –

    Zephyr RTOS module

  • cmake (str) –

    CMake module

  • nsx (str) –

    NSX module (neuralspotx build system)

  • cmsis_pack (str) –

    CMSIS-Pack distribution (Open-CMSIS-Pack .pdsc)

ScheduleMode

Operator dispatch shape emitted into <prefix>_model.c.

Selects how model_init / model_run invoke each operator. Both modes preserve the public ABI (signatures, status enum, lifecycle latch and constant hydration); only the internal dispatch differs.

Attributes:

  • table (str) –

    Runtime function-pointer table iterated by a for loop, with the per-node ctx->callback instrumentation seam preserved. The integration shape for RTOS scheduling / PMU sampling.

  • static (str) –

    A straight-line sequence of direct calls to each operator's _run (and _init) symbol. No function-pointer table, no loop, no indirect dispatch — the AOT-correct shape that is fully optimizer-visible. The per-node callback seam is omitted.

Functions

warn_unknown_config_keys

warn_unknown_config_keys(cls: type, data: object, *, location: str) -> object

mode="before" validator helper: warn about unknown config keys.

Unknown keys currently load silently (pydantic's default extra="ignore" drops them), which hides YAML typos like memory.planer. This surfaces them as deprecation warnings with a did-you-mean suggestion; a future release will reject them outright.

Keys listed in a class's _REMOVED_KEYS are skipped — a dedicated migration validator already hard-errors on those with a better message — and they are excluded from the did-you-mean pool so a typo can never be "corrected" into a key that then hard-errors.

Coverage note: pydantic dataclasses constructed directly with kwargs pass an ArgsKwargs (not a dict) through mode="before" validators, so programmatic TransformSpec(nme=...) stays silent (pre-existing behavior). All dict-driven paths — YAML config, model_validate — are covered.

Parameters:

  • cls

    (type) –

    The pydantic model or dataclass being validated.

  • data

    (object) –

    The raw input; passed through untouched.

  • location

    (str) –

    Human-readable config location for the warning text (e.g. "memory").

Returns: