#include "tensorflow/lite/core/interpreter.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "ruy/denormal.h"
#include "tensorflow/compiler/mlir/lite/experimental/remat/metadata_util.h"
#include "tensorflow/lite/allocation.h"
#include "tensorflow/lite/core/api/error_reporter.h"
#include "tensorflow/lite/core/api/profiler.h"
#include "tensorflow/lite/core/c/c_api_types.h"
#include "tensorflow/lite/core/signature_runner.h"
#include "tensorflow/lite/core/subgraph.h"
#include "tensorflow/lite/external_cpu_backend_context.h"
#include "tensorflow/lite/interpreter_options.h"
#include "tensorflow/lite/logger.h"
#include "tensorflow/lite/minimal_logging.h"
#include "tensorflow/lite/profiling/root_profiler.h"
#include "tensorflow/lite/profiling/telemetry/c/telemetry_setting.h"
#include "tensorflow/lite/profiling/telemetry/telemetry.h"
#include "tensorflow/lite/stderr_reporter.h"
#include "tensorflow/lite/util.h"
#if defined(__ANDROID__)
#define TFLITE_IS_MOBILE_PLATFORM
#endif
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR
#define TFLITE_IS_MOBILE_PLATFORM
#elif TARGET_OS_IPHONE
#define TFLITE_IS_MOBILE_PLATFORM
#endif
#endif
static_assert …;
namespace tflite {
namespace {
TfLiteQuantization GetQuantizationFromLegacy(
const TfLiteQuantizationParams& legacy_quantization) { … }
#define TF_LITE_ENSURE_STATUS_WITH_SCOPED_INSTRUMENTATION(runtime_event, a) …
}
Interpreter::Interpreter(ErrorReporter* error_reporter)
: … { … }
Interpreter::~Interpreter() { … }
void Interpreter::SetExternalContext(TfLiteExternalContextType type,
TfLiteExternalContext* ctx) { … }
TfLiteStatus Interpreter::SetInputs(std::vector<int> inputs) { … }
TfLiteStatus Interpreter::SetOutputs(std::vector<int> outputs) { … }
TfLiteStatus Interpreter::SetVariables(std::vector<int> variables) { … }
TfLiteStatus Interpreter::AllocateTensors() { … }
void Interpreter::AddSubgraphs(int subgraphs_to_add,
int* first_new_subgraph_index) { … }
TfLiteStatus Interpreter::AddNodeWithParameters(
const std::vector<int>& inputs, const std::vector<int>& outputs,
const char* init_data, size_t init_data_size, void* builtin_data,
const TfLiteRegistration* registration, int* node_index) { … }
TfLiteStatus Interpreter::ResizeInputTensor(int tensor_index,
const std::vector<int>& dims) { … }
TfLiteStatus Interpreter::ResizeInputTensorStrict(
int tensor_index, const std::vector<int>& dims) { … }
TfLiteStatus Interpreter::Invoke() { … }
TfLiteStatus Interpreter::AddTensors(int tensors_to_add,
int* first_new_tensor_index) { … }
TfLiteStatus Interpreter::SetTensorParametersReadOnly(
int tensor_index, TfLiteType type, const char* name,
const std::vector<int>& dims, TfLiteQuantization quantization,
const char* buffer, size_t bytes, const Allocation* allocation) { … }
TfLiteStatus Interpreter::SetTensorParametersReadWrite(
int tensor_index, TfLiteType type, const char* name,
const std::vector<int>& dims, TfLiteQuantization quantization,
bool is_variable) { … }
TfLiteStatus Interpreter::SetTensorParametersReadOnly(
int tensor_index, TfLiteType type, const char* name, size_t rank,
const int* dims, TfLiteQuantizationParams quantization, const char* buffer,
size_t bytes, const Allocation* allocation) { … }
TfLiteStatus Interpreter::SetTensorParametersReadWrite(
int tensor_index, TfLiteType type, const char* name, size_t rank,
const int* dims, TfLiteQuantizationParams quantization, bool is_variable,
size_t rank_dims_signature, const int* dims_signature) { … }
TfLiteStatus Interpreter::SetExecutionPlan(const std::vector<int>& new_plan) { … }
TfLiteStatus Interpreter::SetNumThreads(int num_threads) { … }
TfLiteStatus Interpreter::ApplyLazyDelegateProviders() { … }
TfLiteStatus Interpreter::ModifyGraphWithDelegateImpl(
TfLiteDelegate* delegate) { … }
TfLiteStatus Interpreter::RemoveAllDelegates() { … }
TfLiteStatus Interpreter::SetMetadata(
const std::map<std::string, std::string>& metadata) { … }
TfLiteStatus Interpreter::SetTelemetrySettings(
std::unique_ptr<TfLiteTelemetryInterpreterSettings> settings) { … }
TfLiteStatus Interpreter::ReportTelemetrySettings(const char* setting_name) { … }
bool Interpreter::IsFullyDelegated() const { … }
void Interpreter::SetProfilerImpl(std::unique_ptr<Profiler> profiler) { … }
void Interpreter::SetSubgraphProfiler() { … }
TfLiteStatus Interpreter::ApplyOptionsImpl(InterpreterOptions* options) { … }
TfLiteStatus Interpreter::EnableCancellation() { … }
TfLiteStatus Interpreter::Cancel() { … }
void Interpreter::AddProfiler(std::unique_ptr<Profiler> profiler) { … }
impl::SignatureRunner* Interpreter::GetSignatureRunner(
const char* signature_key) { … }
}