aboutsummaryrefslogtreecommitdiff
path: root/test/1.3/QLstm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/1.3/QLstm.cpp')
-rw-r--r--test/1.3/QLstm.cpp73
1 files changed, 30 insertions, 43 deletions
diff --git a/test/1.3/QLstm.cpp b/test/1.3/QLstm.cpp
index 27e52a60..82acba6e 100644
--- a/test/1.3/QLstm.cpp
+++ b/test/1.3/QLstm.cpp
@@ -10,14 +10,10 @@
#include <armnn/utility/IgnoreUnused.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/data/test_case.hpp>
-#include <boost/math/special_functions/relative_difference.hpp>
+#include <doctest/doctest.h>
#include <array>
-BOOST_AUTO_TEST_SUITE(QLSTMTests)
-
using ArmnnDriver = armnn_driver::ArmnnDriver;
using DriverOptions = armnn_driver::DriverOptions;
@@ -26,6 +22,8 @@ using namespace android::hardware;
using HalPolicy = hal_1_3::HalPolicy;
+static const float TOLERANCE = 1.0f;
+
namespace
{
@@ -42,26 +40,6 @@ RequestArgument CreateRequestArgument(const std::vector<T>& value, unsigned int
return inputRequestArgument;
}
-// Returns true if the relative difference between two float values is less than the tolerance value given.
-// This is used because the floating point comparison tolerance (set on each BOOST_AUTO_TEST_CASE) does not work!
-bool TolerantCompareEqual(float a, float b, float tolerance = 1.0f)
-{
- float rd;
- if (a == 0.0f)
- {
- rd = fabs(b);
- }
- else if (b == 0.0f)
- {
- rd = fabs(a);
- }
- else
- {
- rd = boost::math::relative_difference(a, b);
- }
- return rd < tolerance;
-}
-
// Helper function to create an OperandLifeTime::NO_VALUE for testing.
// To be used on optional input operands that have no values - these are valid and should be tested.
HalPolicy::OperandLifeTime CreateNoValueLifeTime(const hidl_vec<uint32_t>& dimensions)
@@ -85,12 +63,6 @@ void ExecuteModel(const armnn_driver::hal_1_3::HalPolicy::Model& model,
}
}
-#ifndef ARMCOMPUTECL_ENABLED
-static const std::array<armnn::Compute, 1> COMPUTE_DEVICES = {{ armnn::Compute::CpuRef }};
-#else
-static const std::array<armnn::Compute, 2> COMPUTE_DEVICES = {{ armnn::Compute::CpuRef, armnn::Compute::CpuAcc }};
-#endif
-
// Add our own tests here since we skip the qlstm tests which Google supplies (because of non-const weights)
void QLstmTestImpl(const hidl_vec<uint32_t>& inputDimensions,
const std::vector<int8_t>& inputValue,
@@ -527,8 +499,8 @@ void QLstmTestImpl(const hidl_vec<uint32_t>& inputDimensions,
// check the results
for (size_t i = 0; i < outputStateOutValue.size(); ++i)
{
- BOOST_TEST(TolerantCompareEqual(outputStateOutValue[i], outputStateOutData[i]),
- "outputStateOut[" << i << "]: " << outputStateOutValue[i] << " != " << outputStateOutData[i]);
+ CHECK_MESSAGE(outputStateOutValue[i] == doctest::Approx( outputStateOutData[i] ).epsilon(TOLERANCE),
+ "outputStateOut[" << i << "]: " << outputStateOutValue[i] << " != " << outputStateOutData[i]);
}
// CELL STATE OUTPUT Does not match currently: IVGCVSW-4860 Verify remaining VTS tests (2) for QLSTM
@@ -541,8 +513,8 @@ void QLstmTestImpl(const hidl_vec<uint32_t>& inputDimensions,
for (size_t i = 0; i < outputValue.size(); ++i)
{
- BOOST_TEST(TolerantCompareEqual(outputValue[i], outputData[i]),
- "output[" << i << "]: " << outputValue[i] << " != " << outputData[i]);
+ CHECK_MESSAGE(outputValue[i] == doctest::Approx( outputData[i] ).epsilon(TOLERANCE),
+ "output[" << i << "]: " << outputValue[i] << " != " << outputData[i]);
}
}
@@ -1028,19 +1000,34 @@ void DynamicOutputQLstmWithNoProjection(armnn::Compute compute)
} // anonymous namespace
// Support is not added yet
-//BOOST_DATA_TEST_CASE(QLSTMWithProjectionTest, COMPUTE_DEVICES)
+//TEST_CASE(QLSTMWithProjectionTest, COMPUTE_DEVICES)
//{
// QLstmWithProjection(sample);
//}
-BOOST_DATA_TEST_CASE(QLSTMWithNoProjectionTest, COMPUTE_DEVICES)
+TEST_SUITE("QLSTMTests_CpuRef")
{
- QLstmWithNoProjection(sample);
-}
+ TEST_CASE("QLSTMWithNoProjectionTest_CpuRef")
+ {
+ QLstmWithNoProjection(armnn::Compute::CpuRef);
+ }
-BOOST_DATA_TEST_CASE(DynamicOutputQLSTMWithNoProjectionTest, COMPUTE_DEVICES)
-{
- DynamicOutputQLstmWithNoProjection(sample);
+ TEST_CASE("DynamicOutputQLstmWithNoProjection_CpuRef")
+ {
+ DynamicOutputQLstmWithNoProjection(armnn::Compute::CpuRef);
+ }
}
+#ifdef ARMCOMPUTECL_ENABLED
+TEST_SUITE("QLSTMTests_CpuAcc")
+{
+ TEST_CASE("QLSTMWithNoProjectionTest_CpuAcc")
+ {
+ QLstmWithNoProjection(armnn::Compute::CpuAcc);
+ }
-BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file
+ TEST_CASE("DynamicOutputQLstmWithNoProjection_CpuAcc")
+ {
+ DynamicOutputQLstmWithNoProjection(armnn::Compute::CpuAcc);
+ }
+}
+#endif