diff options
author | Matthew Sloyan <matthew.sloyan@arm.com> | 2020-09-23 16:57:23 +0100 |
---|---|---|
committer | Colm Donelan <colm.donelan@arm.com> | 2020-10-02 15:05:08 +0000 |
commit | 24ac85943b609e48fc36d16570ca4b5b90d31a6a (patch) | |
tree | 6a279be5b2be2084ddff3ec989a957e17ecad26b /tests | |
parent | 0c8cb872344d3ca4217881d6c70e826ae1776cdb (diff) | |
download | armnn-24ac85943b609e48fc36d16570ca4b5b90d31a6a.tar.gz |
IVGCVSW-5334 Remove remaining boost::numeric_cast from armnn
* Floating point casts now use armnn::numeric_cast.
* Also removed remaining header imports.
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Change-Id: I2d37847d67f164fc0a0ae17f34d49ff3d2210c30
Diffstat (limited to 'tests')
-rw-r--r-- | tests/InferenceTest.cpp | 1 | ||||
-rw-r--r-- | tests/InferenceTest.inl | 5 | ||||
-rw-r--r-- | tests/InferenceTestImage.cpp | 13 | ||||
-rw-r--r-- | tests/MobileNetSsdInferenceTest.hpp | 4 |
4 files changed, 10 insertions, 13 deletions
diff --git a/tests/InferenceTest.cpp b/tests/InferenceTest.cpp index b0d0b47443..64205449ef 100644 --- a/tests/InferenceTest.cpp +++ b/tests/InferenceTest.cpp @@ -8,7 +8,6 @@ #include <Filesystem.hpp> #include "../src/armnn/Profiling.hpp" -#include <boost/numeric/conversion/cast.hpp> #include <boost/format.hpp> #include <boost/program_options.hpp> diff --git a/tests/InferenceTest.inl b/tests/InferenceTest.inl index e10bb38cb0..e8401f6bc3 100644 --- a/tests/InferenceTest.inl +++ b/tests/InferenceTest.inl @@ -7,7 +7,6 @@ #include <armnn/utility/Assert.hpp> #include <armnn/utility/NumericCast.hpp> -#include <boost/numeric/conversion/cast.hpp> #include <boost/program_options.hpp> #include <fmt/format.h> @@ -247,8 +246,8 @@ ClassifierTestCaseProvider<TDatabase, InferenceModel>::GetTestCase(unsigned int template <typename TDatabase, typename InferenceModel> bool ClassifierTestCaseProvider<TDatabase, InferenceModel>::OnInferenceTestFinished() { - const double accuracy = boost::numeric_cast<double>(m_NumCorrectInferences) / - boost::numeric_cast<double>(m_NumInferences); + const double accuracy = armnn::numeric_cast<double>(m_NumCorrectInferences) / + armnn::numeric_cast<double>(m_NumInferences); ARMNN_LOG(info) << std::fixed << std::setprecision(3) << "Overall accuracy: " << accuracy; // If a validation file was requested as output, the predictions are saved to it. diff --git a/tests/InferenceTestImage.cpp b/tests/InferenceTestImage.cpp index a1b6cf4bdb..bb1f5c2397 100644 --- a/tests/InferenceTestImage.cpp +++ b/tests/InferenceTestImage.cpp @@ -8,7 +8,6 @@ #include <armnn/utility/IgnoreUnused.hpp> #include <armnn/utility/NumericCast.hpp> -#include <boost/numeric/conversion/cast.hpp> #include <fmt/format.h> #include <array> @@ -72,8 +71,8 @@ std::vector<float> ResizeBilinearAndNormalize(const InferenceTestImage & image, // How much to scale pixel coordinates in the output image to get the corresponding pixel coordinates // in the input image. - const float scaleY = boost::numeric_cast<float>(inputHeight) / boost::numeric_cast<float>(outputHeight); - const float scaleX = boost::numeric_cast<float>(inputWidth) / boost::numeric_cast<float>(outputWidth); + const float scaleY = armnn::numeric_cast<float>(inputHeight) / armnn::numeric_cast<float>(outputHeight); + const float scaleX = armnn::numeric_cast<float>(inputWidth) / armnn::numeric_cast<float>(outputWidth); uint8_t rgb_x0y0[3]; uint8_t rgb_x1y0[3]; @@ -83,11 +82,11 @@ std::vector<float> ResizeBilinearAndNormalize(const InferenceTestImage & image, for (unsigned int y = 0; y < outputHeight; ++y) { // Corresponding real-valued height coordinate in input image. - const float iy = boost::numeric_cast<float>(y) * scaleY; + const float iy = armnn::numeric_cast<float>(y) * scaleY; // Discrete height coordinate of top-left texel (in the 2x2 texel area used for interpolation). const float fiy = floorf(iy); - const unsigned int y0 = boost::numeric_cast<unsigned int>(fiy); + const unsigned int y0 = armnn::numeric_cast<unsigned int>(fiy); // Interpolation weight (range [0,1]) const float yw = iy - fiy; @@ -95,9 +94,9 @@ std::vector<float> ResizeBilinearAndNormalize(const InferenceTestImage & image, for (unsigned int x = 0; x < outputWidth; ++x) { // Real-valued and discrete width coordinates in input image. - const float ix = boost::numeric_cast<float>(x) * scaleX; + const float ix = armnn::numeric_cast<float>(x) * scaleX; const float fix = floorf(ix); - const unsigned int x0 = boost::numeric_cast<unsigned int>(fix); + const unsigned int x0 = armnn::numeric_cast<unsigned int>(fix); // Interpolation weight (range [0,1]). const float xw = ix - fix; diff --git a/tests/MobileNetSsdInferenceTest.hpp b/tests/MobileNetSsdInferenceTest.hpp index f426ed2ae4..2a5d47d634 100644 --- a/tests/MobileNetSsdInferenceTest.hpp +++ b/tests/MobileNetSsdInferenceTest.hpp @@ -9,8 +9,8 @@ #include <armnn/utility/Assert.hpp> #include <armnn/utility/IgnoreUnused.hpp> +#include <armnn/utility/NumericCast.hpp> -#include <boost/numeric/conversion/cast.hpp> #include <boost/test/tools/floating_point_comparison.hpp> #include <vector> @@ -53,7 +53,7 @@ public: const std::vector<float>& output4 = mapbox::util::get<std::vector<float>>(this->GetOutputs()[3]); ARMNN_ASSERT(output4.size() == k_OutputSize4); - const size_t numDetections = boost::numeric_cast<size_t>(output4[0]); + const size_t numDetections = armnn::numeric_cast<size_t>(output4[0]); // Check if number of valid detections matches expectations const size_t expectedNumDetections = m_DetectedObjects.size(); |