36 runtime_kernel.
readKernel(op_index, runtime_context);
40 const auto body_subgraph_index =
options->body_subgraph_index();
41 const auto cond_subgraph_index =
options->cond_subgraph_index();
63 for (uint32_t i = 0; i < runtime_kernel.
inputs_num; ++i)
65 const auto cur_input_tensor = runtime_kernel.
inputs[i];
66 const auto input_data_size =
sizeof(
core::OMDataType(cur_input_tensor->type())) *
78 for (uint32_t i = 0; i < cond_graphs_inputs; ++i)
80 auto *cur_cond_input_data =
81 reinterpret_cast<uint8_t *
>(cond_runtime_graph->
getInputDataAt(i));
82 uint8_t *cur_main_input_data = runtime_kernel.
outputs_data[i];
83 assert(cur_main_input_data !=
nullptr);
84 assert(cur_cond_input_data !=
nullptr);
85 const auto cur_input_tensor = runtime_kernel.
inputs[i];
86 const auto input_data_size =
sizeof(
core::OMDataType(cur_input_tensor->type())) *
88 std::memcpy(cur_cond_input_data, cur_main_input_data, input_data_size);
98 bool cond_result_value =
reinterpret_cast<bool *
>(cond_runtime_graph->
getOutputDataAt(0))[0];
100 cond_runtime_graph->
reset();
102 if (cond_result_value ==
false)
112 for (uint32_t i = 0; i < body_graphs_inputs; ++i)
114 auto *cur_body_input_data =
115 reinterpret_cast<uint8_t *
>(body_runtime_graph->
getInputDataAt(i));
116 uint8_t *cur_main_input_data = runtime_kernel.
outputs_data[i];
117 assert(cur_main_input_data !=
nullptr);
118 assert(cur_body_input_data !=
nullptr);
119 const auto cur_input_tensor = runtime_kernel.
inputs[i];
120 const auto input_data_size =
sizeof(
core::OMDataType(cur_input_tensor->type())) *
122 std::memcpy(cur_body_input_data, cur_main_input_data, input_data_size);
132 for (uint32_t i = 0; i < runtime_kernel.
inputs_num; ++i)
135 const auto cur_tensor = runtime_kernel.
outputs[i];
138 std::memcpy(runtime_kernel.
outputs_data[i], cur_calculated_data, data_size);
141 body_runtime_graph->
reset();
memory::OMRuntimeAllocator & getRuntimeAllocator()
OMRuntimeContext & getRuntimeContext()
void * getInputDataAt(uint32_t position)
OMRuntimeStorage & getRuntimeStorage()
void * getOutputDataAt(uint32_t position)
uint32_t getNumberOfInputs()
OMStatus allocateGraphInputs()
OMStatus getRuntimeGraphAt(uint32_t pos, OMRuntimeGraph **runtime_graph)
uint8_t * outputs_data[maxOutputSize]
const circle::Operator * first_operator
OMStatus getDataFromStorage(uint16_t op_index, core::OMRuntimeStorage &storage, core::OMRuntimeContext &context)
uint8_t * inputs_data[maxInputSize]
OMStatus readKernel(uint16_t op_index, core::OMRuntimeContext &runtime_context)
const circle::Tensor * outputs[maxOutputSize]
const circle::Tensor * inputs[maxInputSize]
OMDataType
"scalar" value type
core::OMRuntimeContext & runtime_context
core::OMRuntimeStorage & runtime_storage
core::OMRuntimeModule & runtime_module
static OMStatus runForward(OMExecuteArgs &, core::memory::OMRuntimeAllocator &allocator)