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 <sk.namkoong@samsung.com>
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: