Checking a run’s outputs: reference outputs from host LiteRT or caller files, compared tensor by tensor, with a verdict only when a tolerance is given.
Every name on this page is imported from helia_profiler.
API tier: experimental
Generated from the src/helia_profiler tree f38e378c801d34438affb680257217e0b58d2cd1.
Machine-readable model
Toleranceclass Largest accepted absolute error per element, in each tensor's stored units. ReferenceOriginclass Where reference outputs came from. ReferenceOutputsclass Reference bytes for every output, in model order, and their origin. Expectclass What a run's outputs are compared against. TensorComparisonclass Comparison facts for one output tensor. Verificationclass Per-tensor comparison facts, the reference they used and an optional verdict. host_referencefunction Run a LiteRT model on the host and return its output bytes in outputs order. compare_outputsfunction Compare observed output bytes with reference outputs, tensor by tensor. compare_fixture_outputsfunction Compare a fixture capture's outputs with expect.
Tolerance(max_abs_error: float = 0.0 ) -> None
dataclass
Largest accepted absolute error per element, in each tensor’s stored units.
Integer tensors count quantization steps; float tensors count values. One
tolerance applies to every output tensor.
API tier: experimental
max_abs_error: float = 0.0
litert_version: str | None = None ,
resolver: str | None = None ,
invocations: int | None = None ,
dataclass
Where reference outputs came from.
A host reference records the LiteRT package version, its op resolver and
how many times the model was invoked on the inputs.
API tier: experimental
litert_version: str | None = None
resolver: str | None = None
invocations: int | None = None
ReferenceOutputs(origin: ReferenceOrigin, outputs: tuple[ bytes , ... ]) -> None
dataclass
Reference bytes for every output, in model order, and their origin.
API tier: experimental
outputs: tuple[ bytes , ... ]
files: tuple[FixtureFile | Path, ... ] = (),
resolver: LiteRtResolver = 'BUILTIN_REF' ,
tolerance: Tolerance | None = None ,
dataclass
What a run’s outputs are compared against.
Build with :meth:host_litert, :meth:from_build or :meth:from_files.
API tier: experimental
files: tuple[FixtureFile | Path, ... ] = ()
resolver: LiteRtResolver = 'BUILTIN_REF'
tolerance: Tolerance | None = None
host_litert( * , resolver: LiteRtResolver = 'BUILTIN_REF' , tolerance: Tolerance | None = None ) -> Expect
classmethod
Run the model with host LiteRT on the run’s input bytes (LiteRT models only).
from_build( * , tolerance: Tolerance | None = None ) -> Expect
classmethod
Use the expected outputs the fixture build carries.
from_files( * files: FixtureFile | str | Path = (), tolerance: Tolerance | None = None ) -> Expect
classmethod
Compare with caller bytes, one file per output in model order.
mismatched_elements: int ,
max_abs_error_real: float | None ,
within_tolerance: bool | None ,
dataclass
Comparison facts for one output tensor.
max_abs_error is in stored units; max_abs_error_real is the same
error after dequantization, None for an unquantized tensor. A NaN on
one side only counts as a mismatch with infinite error. within_tolerance
is None when no tolerance was given.
API tier: experimental
max_abs_error_real: float | None
within_tolerance: bool | None
Verification(reference: ReferenceOutputs, tensors: tuple[TensorComparison, ... ], tolerance: Tolerance | None ) -> None
dataclass
Per-tensor comparison facts, the reference they used and an optional verdict.
API tier: experimental
reference: ReferenceOutputs
tensors: tuple[TensorComparison, ... ]
tolerance: Tolerance | None
Whether every tensor is within tolerance; None when no tolerance was given.
inputs: Sequence[tuple[FixtureTensor, bytes ]],
outputs: Sequence[FixtureTensor],
resolver: LiteRtResolver = 'BUILTIN_REF' ,
Run a LiteRT model on the host and return its output bytes in outputs order.
inputs must cover every model input. They are restored before every
invocation, as the fixture firmware does, so internal state carries across
invocations while inputs do not.
API tier: experimental
tensors: Sequence[FixtureTensor],
reference: ReferenceOutputs,
observed: Sequence[ bytes ],
tolerance: Tolerance | None = None ,
Compare observed output bytes with reference outputs, tensor by tensor.
API tier: experimental
compare_fixture_outputs(build: FixtureBuild, capture: FixtureCaptureResult, expect: Expect) -> Verification
Compare a fixture capture’s outputs with expect .
A host reference runs the build’s model on its pinned input bytes as many
times as the firmware invokes it (warmups, then timed iterations).
API tier: experimental
Machine-readable: expect.json · expect.md , complete and lossless.