HexagonTpu (hexagon_tpu v0.1.1)

Copy Markdown

Elixir bindings for the Qualcomm Hexagon NPU (HTP) via the QNN (Qualcomm AI Engine Direct) runtime.

Models are pre-compiled QNN context binaries (see docs/models.md for the ONNX/TFLite conversion pipeline). Typical usage:

{:ok, model} = HexagonTpu.load_model("/data/mobilenet_v2.bin")
{:ok, [scores]} = HexagonTpu.predict(model, [input_tensor])

Or with explicit control:

{:ok, rt} = HexagonTpu.Runtime.htp()
{:ok, ctx} = HexagonTpu.Context.from_file(rt, "/data/mobilenet_v2.bin")
{:ok, graph} = HexagonTpu.Graph.retrieve(ctx)
{:ok, outputs} = HexagonTpu.Graph.execute(graph, %{"image" => input_tensor})

Summary

Functions

Whether the NIF is loaded and the HTP backend library can be opened on this system.

Loads a context binary from path on the shared HTP runtime and retrieves its (sole) graph.

Runs inference on a graph returned by load_model/2. See HexagonTpu.Graph.execute/3.

Functions

available?()

Whether the NIF is loaded and the HTP backend library can be opened on this system.

load_model(path, opts \\ [])

Loads a context binary from path on the shared HTP runtime and retrieves its (sole) graph.

predict(graph, inputs, opts \\ [])

Runs inference on a graph returned by load_model/2. See HexagonTpu.Graph.execute/3.