[UTC/ITC][nnstreamer][Non-ACR] Fix tensor clone test 96/261196/2
authorGichan Jang <gichan2.jang@samsung.com>
Tue, 13 Jul 2021 06:01:18 +0000 (15:01 +0900)
committerGichan Jang <gichan2.jang@samsung.com>
Tue, 13 Jul 2021 07:57:56 +0000 (16:57 +0900)
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 <gichan2.jang@samsung.com>
src/itc/nnstreamer/ITs-nnstreamer-tensors.c
src/utc/nnstreamer/utc-nnstreamer-pipeline-tensor-info.c

index 6be328e47400b0c7c598ef325f94b5f5dadd68cb..3164f08f73648555b170d74733f7b2f7afa71998 100755 (executable)
@@ -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));
 
index 9af383c6b7cb3e3b3f6c7d2c36a439b1baa9f5bc..7beba490b855bf37a27661f1deb31bfdd047d666 100644 (file)
@@ -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);