/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ /// \file /// /// Provides functionality to construct an interpreter for a model. /// /// WARNING: Users of TensorFlow Lite should not include this file directly, /// but should instead include /// "third_party/tensorflow/lite/interpreter_builder.h". /// Only the TensorFlow Lite implementation itself should include this /// file directly. #ifndef TENSORFLOW_LITE_CORE_INTERPRETER_BUILDER_H_ #define TENSORFLOW_LITE_CORE_INTERPRETER_BUILDER_H_ #include <map> #include <memory> #include <string> #include <utility> #include <vector> #include "flatbuffers/flatbuffers.h" #include "tensorflow/lite/allocation.h" #include "tensorflow/lite/core/api/error_reporter.h" #include "tensorflow/lite/core/api/op_resolver.h" #include "tensorflow/lite/core/c/common.h" #include "tensorflow/lite/core/interpreter.h" #include "tensorflow/lite/core/model_builder.h" #include "tensorflow/lite/core/subgraph.h" #include "tensorflow/lite/mutable_op_resolver.h" #include "tensorflow/lite/profiling/telemetry/c/telemetry_setting_internal.h" #include "tensorflow/lite/profiling/telemetry/profiler.h" #include "tensorflow/lite/schema/schema_generated.h" #include "tensorflow/lite/stderr_reporter.h" namespace tflite { /// Build an interpreter capable of interpreting `model`. /// /// * `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()`. /// * `options_experimental`: Options that can change behavior of interpreter. /// WARNING: this parameter is an experimental API and is subject to change. /// /// Returns a kTfLiteOk when successful and sets interpreter to a valid /// Interpreter. Note: The user must ensure the lifetime of the model (and error /// reporter, if provided) is at least as long as interpreter's lifetime, and /// a single model instance may safely be used with multiple interpreters. InterpreterBuilder; namespace impl { class InterpreterBuilder { … }; } // namespace impl } // namespace tflite #endif // TENSORFLOW_LITE_CORE_INTERPRETER_BUILDER_H_