HexagonTpu.Graph (hexagon_tpu v0.1.0)

Copy Markdown

An executable graph retrieved from a loaded context.

execute/3 is the Nx boundary: it takes Nx tensors, handles quantization per the graph's tensor metadata, runs inference on the backend, and returns Nx tensors.

Summary

Functions

Graph metadata (HexagonTpu.GraphInfo).

Retrieves a graph by name. With nil (default), the context must contain exactly one graph.

Types

t()

@type t() :: %HexagonTpu.Graph{
  context: HexagonTpu.Context.t(),
  info: HexagonTpu.GraphInfo.t(),
  resource: reference()
}

Functions

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

Runs inference.

inputs is a list of Nx tensors (positional, matching info.inputs order) or a map of %{"tensor_name" => tensor}.

Options:

  • :quantize - :auto (default) quantizes {:f, 32} inputs to the tensor's on-device quantized type; :none requires exact-type input.
  • :dequantize - :auto (default) dequantizes quantized outputs to {:f, 32}; :none returns raw on-device types.
  • :output - :list (default) or :map (keyed by tensor name).

info(graph)

Graph metadata (HexagonTpu.GraphInfo).

retrieve(context, name \\ nil)

Retrieves a graph by name. With nil (default), the context must contain exactly one graph.