[Singleshot] Enhance dim inference for nntrainer submit/tizen/20211116.052326
authorJihoon Lee <jhoon.it.lee@samsung.com>
Mon, 15 Nov 2021 08:03:04 +0000 (17:03 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Tue, 16 Nov 2021 04:50:38 +0000 (13:50 +0900)
commit1feb5e94e72d89b142bc714d538c585a82b97dd6
treed706a5eac28554cc68642d5f7039c29e290cae00
parent7515e43f8f02a28aac72e02c733b15af38dc3854
[Singleshot] Enhance dim inference for nntrainer

There was a voc that `ml_single_open(&single, 'model.ini', NULL, NULL,
ML_NNFW_TYPE_NNTR_INF, ML_NNFW_HW_ANY);` should work, which is giving
NULL for the tensor_input info and tensor output info.

This was not feasible because the nntrainer inference filter is not
defining `getInputDim()`, `getOutputDim()` on purpose to make it able to
infer output dimension from input dimension in pipeline scenario.

This patch introduce the dimension inferencing mechanism for nntrainer
to make it coherent with the pipeline api.

Below rules apply when input_info or output_info is nullptr for
nntrainer.

1. After opening the framework, allow calling set_input_dim with input_info with
count==0 in case of nntrainer.
2. nntrainer checks if input_info->count==0, if true, nntrainer assums
it should be default dimension and set input/output dimension accordingly.

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
c/src/ml-api-inference-single.c