xref: /aosp_15_r20/external/android-nn-driver/test/TestHalfTensor.cpp (revision 3e777be0405cee09af5d5785ff37f7cfb5bee59a)
1 //
2 // Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "TestHalfTensor.hpp"
7 
8 namespace driverTestHelpers
9 {
10 
GetDimensions() const11 hidl_vec<uint32_t> TestHalfTensor::GetDimensions() const
12 {
13     hidl_vec<uint32_t> dimensions;
14     dimensions.resize(m_Shape.GetNumDimensions());
15     for (uint32_t i=0; i<m_Shape.GetNumDimensions(); ++i)
16     {
17         dimensions[i] = m_Shape[i];
18     }
19     return dimensions;
20 }
21 
GetNumElements() const22 unsigned int TestHalfTensor::GetNumElements() const
23 {
24     return m_Shape.GetNumElements();
25 }
26 
GetData() const27 const Half * TestHalfTensor::GetData() const
28 {
29     DOCTEST_CHECK(m_Data.empty() == false);
30     return &m_Data[0];
31 }
32 
33 } // namespace driverTestHelpers
34