Skip to content

litert

Classes

LitertInterpreter

LitertInterpreter(model_path: Path)

LiteRT based interpreter.

Functions

set_input
set_input(tensor: AirTensor | ndarray, *, key: str | int | None = None) -> None

Assign data to one of the interpreter's inputs.

Note

If an AirTensor is passed, its .data will be used.

Parameters:

  • tensor
    (AirTensor | ndarray) –

    The input tensor to set.

  • key
    (str | int | None, default: None ) –

    The key to identify the input tensor.

invoke
invoke() -> None

Run inference.

get_output
get_output(*, key: str | int | None = None, wrap: bool = False) -> np.ndarray | AirTensor

Retrieve an output tensor. If wrap=True, returns an AirTensor with .data populated.

Parameters:

  • key
    (str | int | None, default: None ) –

    The name or ID of the output tensor. If None, will use the first output.

  • wrap
    (bool, default: False ) –

    If True, returns an AirTensor

Returns:

Functions