View Source tflite_beam_interpreter_builder (tflite_beam v1.0.0-rc2)
Build an interpreter capable of interpreting model.
Summary
Functions
Attach a delegate to the builder, with the default decline policy.
Attach a delegate to every interpreter this builder goes on to build.
Build the interpreter with the InterpreterBuilder.
New InterpreterBuilder
Sets the number of CPU threads to use for the interpreter. Returns ok on success, {error, Reason} on error.
Functions
Attach a delegate to the builder, with the default decline policy.
Equivalent to add_delegate(Builder, Delegate, #{}).
Attach a delegate to every interpreter this builder goes on to build.
The delegate is applied in the order delegates were added, and it has to outlive every interpreter built from this builder -- which is why there is no way to detach or delete one. Holding the reference is not required: the builder and each interpreter keep the delegate alive for as long as they need it.
Keyword Parameters
Build the interpreter with the InterpreterBuilder.
Note: all Interpreters should be built with the InterpreterBuilder, which allocates memory for the Interpreter and does various set up tasks so that the Interpreter can read the provided model.
Returns {ok, delegate_declined} when a delegate added with on_decline => fallback could not take the graph and the interpreter was built without it. See add_delegate/3.
-spec new(#tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | reference(), reference()) -> {ok, reference()} | {error, binary()}.
New InterpreterBuilder
Sets the number of CPU threads to use for the interpreter. Returns ok on success, {error, Reason} on error.
NumThreads follows TfLite: -1 asks the runtime to choose, 0 means the same as 1, and anything below -1 is refused. The spec said pos_integer(), which excluded both of the first two.