17#include "luci_interpreter/Interpreter.h"
19#include "loader/ModuleLoader.h"
24#ifdef USE_STATIC_ALLOC
28 _runtime_module = std::make_unique<RuntimeModule>();
30 _memory_manager = StaticMemoryManager(configuration._input_buf_size, configuration._temp_buf_size,
31 configuration._output_buf_size)
36 if (configuration.isStaticManager())
38 _memory_manager = std::make_unique<StaticMemoryManager>(
39 configuration._input_buf_size, configuration._temp_buf_size, configuration._output_buf_size);
43 _memory_manager = std::make_unique<SimpleMemoryManager>();
46 _memory_manager->is_allocate_input(configuration.getAllocateInputValue());
48 ModuleLoader loader();
50 configuration.isStaticManager(), model_data_raw);
52 ModuleLoader loader(_runtime_module.get(), _memory_manager.get());
53 loader.load(configuration.isStaticManager(), model_data_raw);
71 auto *runtime_graph = _runtime_module.getMainGraph();
73 return runtime_graph->getInputDataSizeByIndex(input_tensor_index);
78 auto *runtime_graph = _runtime_module.getMainGraph();
80 return runtime_graph->getOutputDataSizeByIndex(output_tensor_index);
86 assert(data_size > 0);
87 assert(
data !=
nullptr);
88 assert(input_tensor_index >= 0);
89 auto *runtime_graph = _runtime_module.getMainGraph();
90 auto tensor_data = runtime_graph->configureGraphInput(input_tensor_index);
92 std::memcpy(tensor_data,
data, data_size);
97 assert(input_tensor_index >= 0);
99 auto *runtime_graph = _runtime_module.getMainGraph();
101 return runtime_graph->configureGraphInput(input_tensor_index);
106 auto *runtime_graph = _runtime_module.getMainGraph();
108 return runtime_graph->getOutputDataByIndex(output_tensor_index);
void allocateAndWriteInputTensor(int32_t input_tensor_index, const uint8_t *data, size_t data_size)
int32_t getInputDataSizeByIndex(int32_t input_tensor_index)
uint8_t * allocateInputTensor(int32_t input_tensor_index)
Interpreter(const luci::Module *module)
void readOutputTensor(const luci::CircleOutput *output_node, void *data, size_t data_size)
int32_t getOutputDataSizeByIndex(int32_t output_tensor_index)
const T * data(const std::vector< T, Alloc > &v)