aboutsummaryrefslogtreecommitdiff
path: root/test/TestHalfTensor.cpp
diff options
context:
space:
mode:
authorCathal Corbett <cathal.corbett@arm.com>2022-12-20 18:35:34 +0000
committerCathal Corbett <cathal.corbett@arm.com>2022-12-21 15:12:02 +0000
commit0637bf38b24bba3a3d88f34ed956111a3abddda2 (patch)
tree81b348da58714cb817fcf6ab3bb31368b56ca8b7 /test/TestHalfTensor.cpp
parent8de96f7e72e212503dadb450ccdcd15b411a7a1a (diff)
downloadandroid-nn-driver-0637bf38b24bba3a3d88f34ed956111a3abddda2.tar.gz
IVGCVSW-7211 Fix float16 operators being wrongly unsupported with android-nn-driver.
!armnn:8862 * Added float16 mean test cases. * Float16 CTS/CTS pass on CpuAcc. Signed-off-by: Cathal Corbett <cathal.corbett@arm.com> Change-Id: Ibd9021d0ae4a205cc2c91555f3ae00c6dba84609
Diffstat (limited to 'test/TestHalfTensor.cpp')
-rw-r--r--test/TestHalfTensor.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/TestHalfTensor.cpp b/test/TestHalfTensor.cpp
new file mode 100644
index 00000000..12cdc427
--- /dev/null
+++ b/test/TestHalfTensor.cpp
@@ -0,0 +1,33 @@
+//
+// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "TestHalfTensor.hpp"
+
+namespace driverTestHelpers
+{
+
+hidl_vec<uint32_t> TestHalfTensor::GetDimensions() const
+{
+ hidl_vec<uint32_t> dimensions;
+ dimensions.resize(m_Shape.GetNumDimensions());
+ for (uint32_t i=0; i<m_Shape.GetNumDimensions(); ++i)
+ {
+ dimensions[i] = m_Shape[i];
+ }
+ return dimensions;
+}
+
+unsigned int TestHalfTensor::GetNumElements() const
+{
+ return m_Shape.GetNumElements();
+}
+
+const Half * TestHalfTensor::GetData() const
+{
+ DOCTEST_CHECK(m_Data.empty() == false);
+ return &m_Data[0];
+}
+
+} // namespace driverTestHelpers