From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Thu, 30 Aug 2018 06:48:36 +0000 (+0900) Subject: [enco] Emit setInput and setOutput calls (#1246) X-Git-Tag: nncc_backup~2007 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1c82c9217689dc4e091d88ddb9d870c6064c440;p=platform%2Fcore%2Fml%2Fnnfw.git [enco] Emit setInput and setOutput calls (#1246) With this commit, generated code will includes the call for the following APIs (if necessary): - ANeuralNetworksExecution_setInput - ANeuralNetworksExecution_setOutput Signed-off-by: Jonghyun Park --- diff --git a/contrib/enco/core/src/CppGen/Subnet.cpp b/contrib/enco/core/src/CppGen/Subnet.cpp index 4f77211..df16df6 100644 --- a/contrib/enco/core/src/CppGen/Subnet.cpp +++ b/contrib/enco/core/src/CppGen/Subnet.cpp @@ -394,8 +394,27 @@ std::unique_ptr SubnetBlockCompiler::compile(const ANNBinder res->append(); res->append("ANeuralNetworksExecution_create(", compilation, ", &execution);"); - // TODO Invoke setInput & setOutput method - res->append(S(assert("NYI");)); + // Emit ANeuralNetworksExecution_setInput call(s) + for (uint32_t n = 0; n < binder->module()->input()->size(); ++n) + { + auto bag = binder->input(n); + auto base = _mem.base(bag); + auto size = _mem.size(bag); + + res->append("ANeuralNetworksExecution_setInput(execution, ", n, ", nullptr, ", base, ", ", size, + ");"); + } + + // Emit ANeuralNetworksExecution_setOutput call(s) + for (uint32_t n = 0; n < binder->module()->output()->size(); ++n) + { + auto bag = binder->output(n); + auto base = _mem.base(bag); + auto size = _mem.size(bag); + + res->append("ANeuralNetworksExecution_setOutput(execution, ", n, ", nullptr, ", base, ", ", + size, ");"); + } res->append("ANeuralNetworksExecution_startCompute(execution, &event);"); res->append("ANeuralNetworksEvent_wait(event);");