diff --git a/unit_tests/Tests_Utils.cpp b/unit_tests/Tests_Utils.cpp index 91cd54f67cf0c96f977b5b87e92214faee7de2e4..5f6cd7103c1afaa673898d71db6c5c05fdfd1bfe 100644 --- a/unit_tests/Tests_Utils.cpp +++ b/unit_tests/Tests_Utils.cpp @@ -65,21 +65,17 @@ TEMPLATE_TEST_CASE("Opencv Utils", "[Utils][OpenCV]", signed char, unsigned char REQUIRE(mat.cols == tensorOcv->dims()[0]); REQUIRE(mat.channels() == tensorOcv->dims()[2]); - // Check the matrix inside the tensor coorresponds to the matrix + //Get the matrix inside the tensor TensorImpl_opencv_* tImpl_opencv = dynamic_cast<TensorImpl_opencv_*>(tensorOcv->getImpl().get()); auto mat_tensor = tImpl_opencv->data(); - - REQUIRE(mat_tensor.size() == mat.size()); - REQUIRE(cv::countNonZero(mat_tensor != mat) == 0); - - // Convert opencv tensor to cpu tensor - auto tensorCpu = convertCpu(tensorOcv); - // Split the mat from tensor opencv into channels std::vector<cv::Mat> channels_split; cv::split(mat_tensor, channels_split); - // Get the ptr to the std::vector<TestType> as a void * with rawPtr() + // Convert opencv tensor to cpu tensor + auto tensorCpu = convertCpu(tensorOcv); + + // Get the cpu ptr of the converted tensor auto cpu_ptr = static_cast<TestType*>(tensorCpu->getImpl()->rawPtr()); // Compare the tensor cpu values with the cv mat in an elementwise fashion