From 7ab141a93089395a1958b4bca4e5d9cd94ce8cf7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/=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: Mon, 3 Dec 2018 19:43:43 +0900 Subject: [PATCH] Handle optional input & output on frontend (#3763) - Throw exception when optional input is set because we cannot support this yet - Return with do nothing for optional output Signed-off-by: Hyeongseok Oh --- runtimes/neurun/src/frontend/execution.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/runtimes/neurun/src/frontend/execution.cc b/runtimes/neurun/src/frontend/execution.cc index 4cc7bb9..f35db59 100644 --- a/runtimes/neurun/src/frontend/execution.cc +++ b/runtimes/neurun/src/frontend/execution.cc @@ -180,6 +180,12 @@ int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution *execution, int32 return ANEURALNETWORKS_UNEXPECTED_NULL; } + // TODO Handle optional input + if (buffer == nullptr) + { + throw std::runtime_error("Not supported optional input, yet"); + } + const auto &operands = execution->plan().model().operands(); // TODO Check type conflicts @@ -208,6 +214,12 @@ int ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution *execution, int3 return ANEURALNETWORKS_UNEXPECTED_NULL; } + // Handle optional output + if (buffer == nullptr) + { + return ANEURALNETWORKS_NO_ERROR; + } + const auto &operands = execution->plan().model().operands(); // TODO Check type conflicts -- 2.7.4