From: Gichan Jang Date: Tue, 13 Jul 2021 06:01:18 +0000 (+0900) Subject: [UTC/ITC][nnstreamer][Non-ACR] Fix tensor clone test X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=285d45bfceffe304594902f136d7420c06d7356c;p=test%2Ftct%2Fnative%2Fapi.git [UTC/ITC][nnstreamer][Non-ACR] Fix tensor clone test Fix tensor clone test. ml_tensor_info_clone function changed to check the number of the tensors of source info. So, set the num_tesnors for source info. Change-Id: I5e524a84dcb52111f6c20b6d3970aeaef999fc07 Signed-off-by: Gichan Jang --- diff --git a/src/itc/nnstreamer/ITs-nnstreamer-tensors.c b/src/itc/nnstreamer/ITs-nnstreamer-tensors.c index 6be328e47..3164f08f7 100755 --- a/src/itc/nnstreamer/ITs-nnstreamer-tensors.c +++ b/src/itc/nnstreamer/ITs-nnstreamer-tensors.c @@ -163,6 +163,16 @@ int ITc_nnstreamer_tensors_ml_tensors_info_clone_p(void) int nRet = -1; ml_tensors_info_h hTensorsInfoHandle = NULL; ml_tensors_info_h hCloneTensorsInfoHandle = NULL; + ml_tensor_dimension inputTensorDimension; + ml_tensor_dimension outputTensorDimension; + ml_tensor_type_e eGetTensorType = -1; + unsigned int nSetCount = 1; + unsigned int nGetCount = 0; + + inputTensorDimension[0] = 10; + inputTensorDimension[1] = 1; + inputTensorDimension[2] = 1; + inputTensorDimension[3] = 1; nRet = ml_tensors_info_create (&hTensorsInfoHandle); PRINT_RESULT(ML_ERROR_NONE, nRet, "ml_tensors_info_create", NnStreamerGetError(nRet)); @@ -172,9 +182,31 @@ int ITc_nnstreamer_tensors_ml_tensors_info_clone_p(void) PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_tensors_info_create", NnStreamerGetError(nRet),ml_tensors_info_destroy (hTensorsInfoHandle)); CHECK_HANDLE_CLEANUP(hCloneTensorsInfoHandle, "ml_tensors_info_create",ml_tensors_info_destroy (hTensorsInfoHandle)); + nRet = ml_tensors_info_set_count (hTensorsInfoHandle, nSetCount); + PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_tensors_info_set_count", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + nRet = ml_tensors_info_set_tensor_type (hTensorsInfoHandle, 0, ML_TENSOR_TYPE_UINT8); + PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_tensors_info_set_tensor_type", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + nRet = ml_tensors_info_set_tensor_dimension (hTensorsInfoHandle, 0, inputTensorDimension); + PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_tensors_info_set_tensor_dimension", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + nRet = ml_tensors_info_clone (hCloneTensorsInfoHandle, hTensorsInfoHandle); PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_tensors_info_clone", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + nRet = ml_tensors_info_get_count (hCloneTensorsInfoHandle, &nGetCount); + PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_tensors_info_get_count", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + PRINT_RESULT_CLEANUP(nSetCount, nGetCount, "ml_tensors_info_get_count", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + + nRet = ml_tensors_info_get_tensor_type (hCloneTensorsInfoHandle, 0, &eGetTensorType); + PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_tensors_info_get_tensor_type", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + PRINT_RESULT_CLEANUP(ML_TENSOR_TYPE_UINT8, eGetTensorType, "ml_tensors_info_get_tensor_type", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + + nRet = ml_tensors_info_get_tensor_dimension (hCloneTensorsInfoHandle, 0, outputTensorDimension); + PRINT_RESULT_CLEANUP(ML_ERROR_NONE, nRet, "ml_tensors_info_get_tensor_dimension", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + PRINT_RESULT_CLEANUP(inputTensorDimension[0], outputTensorDimension[0], "ml_tensors_info_get_tensor_dimension", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + PRINT_RESULT_CLEANUP(inputTensorDimension[1], outputTensorDimension[1], "ml_tensors_info_get_tensor_dimension", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + PRINT_RESULT_CLEANUP(inputTensorDimension[2], outputTensorDimension[2], "ml_tensors_info_get_tensor_dimension", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + PRINT_RESULT_CLEANUP(inputTensorDimension[3], outputTensorDimension[3], "ml_tensors_info_get_tensor_dimension", NnStreamerGetError(nRet),ml_tensors_info_destroy (hCloneTensorsInfoHandle);ml_tensors_info_destroy (hTensorsInfoHandle)); + nRet = ml_tensors_info_destroy (hCloneTensorsInfoHandle); PRINT_RESULT_NORETURN(ML_ERROR_NONE, nRet, "ml_tensors_info_destroy", NnStreamerGetError(nRet)); diff --git a/src/utc/nnstreamer/utc-nnstreamer-pipeline-tensor-info.c b/src/utc/nnstreamer/utc-nnstreamer-pipeline-tensor-info.c index 9af383c6b..7beba490b 100644 --- a/src/utc/nnstreamer/utc-nnstreamer-pipeline-tensor-info.c +++ b/src/utc/nnstreamer/utc-nnstreamer-pipeline-tensor-info.c @@ -171,15 +171,45 @@ int utc_ml_tensors_info_clone_p (void) { IS_SUPPORT_FEATURE; ml_tensors_info_h in_info, out_info; + guint count = 0; + ml_tensor_dimension in_dim, out_dim; + ml_tensor_type_e type = ML_TENSOR_TYPE_UNKNOWN; status = ml_tensors_info_create (&in_info); assert_eq (status, ML_ERROR_NONE); status = ml_tensors_info_create (&out_info); assert_eq (status, ML_ERROR_NONE); + in_dim[0] = 5; + in_dim[1] = 1; + in_dim[2] = 1; + in_dim[3] = 1; + + status = ml_tensors_info_set_count (in_info, 1); + assert_eq (status, ML_ERROR_NONE); + status = ml_tensors_info_set_tensor_type (in_info, 0, ML_TENSOR_TYPE_UINT8); + assert_eq (status, ML_ERROR_NONE); + status = ml_tensors_info_set_tensor_dimension (in_info, 0, in_dim); + assert_eq (status, ML_ERROR_NONE); + status = ml_tensors_info_clone (out_info, in_info); assert_eq (status, ML_ERROR_NONE); + status = ml_tensors_info_get_count (out_info, &count); + assert_eq (status, ML_ERROR_NONE); + assert_eq (count, 1U); + + status = ml_tensors_info_get_tensor_type (out_info, 0, &type); + assert_eq (status, ML_ERROR_NONE); + assert_eq (type, ML_TENSOR_TYPE_UINT8); + + status = ml_tensors_info_get_tensor_dimension (out_info, 0, out_dim); + assert_eq (status, ML_ERROR_NONE); + assert_eq (in_dim[0], out_dim[0]); + assert_eq (in_dim[1], out_dim[1]); + assert_eq (in_dim[2], out_dim[2]); + assert_eq (in_dim[3], out_dim[3]); + status = ml_tensors_info_destroy (in_info); assert_eq (status, ML_ERROR_NONE); status = ml_tensors_info_destroy (out_info);