View Source TFLiteElixir.SignatureRunner (tflite_elixir v0.4.0-rc1)
A runner for one of a model's signatures.
A signature names a subgraph together with its inputs and outputs, so tensors are
addressed by name instead of by index and the order of a model's outputs no longer
has to be worked out. Obtain one with TFLiteElixir.Interpreter.get_signature_runner/2.
A runner belongs to the interpreter it came from and keeps that interpreter alive, so it stays usable even if nothing else refers to the interpreter any more. Like the interpreter it is not safe to use from more than one process at a time.
Summary
Functions
Allocate the tensors of the signature's subgraph.
Cancel an in-flight invocation.
The names of the signature's inputs.
Raising version of input_names/1.
How many inputs the signature has.
Raising version of input_size/1.
Write data into the named input.
Run the signature.
The names of the signature's outputs.
Raising version of output_names/1.
How many outputs the signature has.
Raising version of output_size/1.
Read the named output.
Raising version of output_tensor/2.
Feed the signature its inputs, run it and read every output back.
Raising version of predict/2.
Change the dimensions of the named input.
Change the dimensions of the named input, keeping the rank fixed.
The key this runner was obtained with.
Raising version of signature_key/1.
Types
@type nif_error() :: {:error, String.t()}
Functions
Allocate the tensors of the signature's subgraph.
Cancel an in-flight invocation.
The names of the signature's inputs.
Raising version of input_names/1.
@spec input_size(reference()) :: {:ok, non_neg_integer()} | nif_error()
How many inputs the signature has.
Raising version of input_size/1.
Write data into the named input.
allocate_tensors/1 has to have been called first.
Run the signature.
The names of the signature's outputs.
Raising version of output_names/1.
@spec output_size(reference()) :: {:ok, non_neg_integer()} | nif_error()
How many outputs the signature has.
Raising version of output_size/1.
Read the named output.
Raising version of output_tensor/2.
@spec predict(reference(), %{required(String.t()) => binary()}) :: {:ok, %{required(String.t()) => binary()}} | nif_error()
Feed the signature its inputs, run it and read every output back.
Inputs and outputs are maps keyed by the names the signature declares, which is what makes a signature worth using: neither side depends on the order the model happens to list its tensors in.
Raising version of predict/2.
Change the dimensions of the named input.
allocate_tensors/1 has to be called again afterwards.
Change the dimensions of the named input, keeping the rank fixed.
Only dimensions the model left unknown can be changed.
The key this runner was obtained with.
Raising version of signature_key/1.