TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tflite::InterpreterBuilder

#include <model.h>

Build an interpreter capable of interpreting model.

Summary

model: A model whose lifetime must be at least as long as any interpreter(s) created by the builder. In principle multiple interpreters can be made from a single model. op_resolver: An instance that implements the OpResolver interface, which maps custom op names and builtin op codes to op registrations. The lifetime of the provided op_resolver object must be at least as long as the InterpreterBuilder; unlike model and error_reporter, the op_resolver does not need to exist for the duration of any created Interpreter objects. error_reporter: a functor that is called to report errors that handles printf var arg semantics. The lifetime of the error_reporter object must be greater than or equal to the Interpreter created by operator().

Returns a kTfLiteOk when successful and sets interpreter to a valid Interpreter. Note: The user must ensure the model lifetime (and error reporter, if provided) is at least as long as interpreter's lifetime.

Constructors and Destructors

InterpreterBuilder(const FlatBufferModel & model, const OpResolver & op_resolver)
InterpreterBuilder(const ::tflite::Model *model, const OpResolver & op_resolver, ErrorReporter *error_reporter)
Builds an interpreter given only the raw flatbuffer Model object (instead of a FlatBufferModel).
InterpreterBuilder(const InterpreterBuilder &)
~InterpreterBuilder()

Public functions

operator()(std::unique_ptr< Interpreter > *interpreter)
TfLiteStatus
operator()(std::unique_ptr< Interpreter > *interpreter, int num_threads)
TfLiteStatus
operator=(const InterpreterBuilder &)=delete

Public functions

InterpreterBuilder

 InterpreterBuilder(
  const FlatBufferModel & model,
  const OpResolver & op_resolver
)

InterpreterBuilder

 InterpreterBuilder(
  const ::tflite::Model *model,
  const OpResolver & op_resolver,
  ErrorReporter *error_reporter
)

Builds an interpreter given only the raw flatbuffer Model object (instead of a FlatBufferModel).

Mostly used for testing. If error_reporter is null, then DefaultErrorReporter() is used.

InterpreterBuilder

 InterpreterBuilder(
  const InterpreterBuilder &
)=delete

operator()

TfLiteStatus operator()(
  std::unique_ptr< Interpreter > *interpreter
)

operator()

TfLiteStatus operator()(
  std::unique_ptr< Interpreter > *interpreter,
  int num_threads
)

operator=

InterpreterBuilder & operator=(
  const InterpreterBuilder &
)=delete

~InterpreterBuilder

 ~InterpreterBuilder()