diff options
Diffstat (limited to 'test/TestHalfTensor.hpp')
-rw-r--r-- | test/TestHalfTensor.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/TestHalfTensor.hpp b/test/TestHalfTensor.hpp new file mode 100644 index 00000000..2b7870f4 --- /dev/null +++ b/test/TestHalfTensor.hpp @@ -0,0 +1,38 @@ +// +// Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include <ArmnnDriver.hpp> +#include "DriverTestHelpers.hpp" + +#include <half/half.hpp> + +using Half = half_float::half; + +namespace driverTestHelpers +{ + +class TestHalfTensor +{ +public: + TestHalfTensor(const armnn::TensorShape & shape, + const std::vector<Half> & data) + : m_Shape{shape} + , m_Data{data} + { + DOCTEST_CHECK(m_Shape.GetNumElements() == m_Data.size()); + } + + hidl_vec<uint32_t> GetDimensions() const; + unsigned int GetNumElements() const; + const Half * GetData() const; + +private: + armnn::TensorShape m_Shape; + std::vector<Half> m_Data; +}; + +} // driverTestHelpers |