From: 남궁석/동작제어Lab(SR)/Engineer/삼성전자 Date: Fri, 24 Aug 2018 02:28:46 +0000 (+0900) Subject: Enable to pass ValidationTestModel.AddOperation in pureacl (#2451) X-Git-Tag: 0.2~184 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dea192869775d188641b4972576d6511fe302fe6;p=platform%2Fcore%2Fml%2Fnnfw.git Enable to pass ValidationTestModel.AddOperation in pureacl (#2451) In `ValidationTestModel.AddOperation`, if inputs or outputs are `nullptr`, it is always error even if `inputCount` and `outputCount` is zero. This commit will modify those conditions, and add some checkings to pass the test. - Modify `nullptr` check condition - Add checking if building model is finished or not - Add checking if type is invalid or not Signed-off-by: Seok NamKoong --- diff --git a/runtimes/pure_arm_compute/src/model.cc b/runtimes/pure_arm_compute/src/model.cc index d93b4ca..7a96038 100644 --- a/runtimes/pure_arm_compute/src/model.cc +++ b/runtimes/pure_arm_compute/src/model.cc @@ -104,12 +104,21 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs) { - if ((model == nullptr) || ((inputs == nullptr) && (inputCount != 0)) || - ((outputs == nullptr) && (outputCount != 0))) + if (model == nullptr || inputs == nullptr || outputs == nullptr) { return ANEURALNETWORKS_UNEXPECTED_NULL; } + if (model->isFinished()) + { + return ANEURALNETWORKS_BAD_STATE; + } + + if (type < ANEURALNETWORKS_ADD || type > ANEURALNETWORKS_TRANSPOSE) + { + return ANEURALNETWORKS_BAD_DATA; + } + switch (type) { case ANEURALNETWORKS_ADD: