From 14ed95775e7766b0e292b7ed906c0b20585182f7 Mon Sep 17 00:00:00 2001 From: thibault allenet <thibault.allenet@cea.fr> Date: Tue, 20 Feb 2024 09:05:53 +0000 Subject: [PATCH] Update Tests_Utils --- unit_tests/Tests_Utils.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/unit_tests/Tests_Utils.cpp b/unit_tests/Tests_Utils.cpp index 91cd54f..5f6cd71 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 -- GitLab