aboutsummaryrefslogtreecommitdiff
path: root/test/TestHalfTensor.cpp
blob: 12cdc427b2a4e61b43d67455d55ce53efd08f3aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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