View Source tflite_beam_signature_runner (tflite_beam v1.0.0)
A runner for one of a model's signatures.
A signature names a subgraph together with its inputs and outputs, so the tensors are addressed by name rather than by index and the ordering of a model's outputs no longer has to be guessed.
A runner belongs to the interpreter it came from and cannot outlive it. Like the interpreter itself it is not safe to use from more than one process at a time; serialise access if several processes share one.
Summary
Functions
Allocate the tensors of the signature's subgraph.
Cancel an in-flight invocation.
The names of the signature's inputs.
How many inputs the signature has.
Write data into the named input.
Run the signature.
The names of the signature's outputs.
How many outputs the signature has.
Read the named output.
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.
Functions
Allocate the tensors of the signature's subgraph.
Cancel an in-flight invocation.
Requires tflite_beam_interpreter:enable_cancellation/1 on the interpreter this runner came from. Without it TFLite refuses, and the reason it gives does not say why.
The names of the signature's inputs.
-spec input_size(reference()) -> {ok, non_neg_integer()} | {error, binary()}.
How many inputs the signature has.
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.
-spec output_size(reference()) -> {ok, non_neg_integer()} | {error, binary()}.
How many outputs the signature has.
Read the named output.
-spec resize_input_tensor(reference(), binary() | list(), [integer()] | tuple()) -> ok | {error, binary()}.
Change the dimensions of the named input.
allocate_tensors/1 has to be called again afterwards.
Dims is a list, or the tuple tflite_beam_tensor:shape/1 returns.
-spec resize_input_tensor_strict(reference(), binary() | list(), [integer()] | tuple()) -> ok | {error, binary()}.
Change the dimensions of the named input, keeping the rank fixed.
Only dimensions the model left unknown can be changed.
Dims is a list, or the tuple tflite_beam_tensor:shape/1 returns.
The key this runner was obtained with.