From f1c82c9217689dc4e091d88ddb9d870c6064c440 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Thu, 30 Aug 2018 15:48:36 +0900 Subject: [PATCH] [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 --- contrib/enco/core/src/CppGen/Subnet.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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);"); -- 2.7.4