aboutsummaryrefslogtreecommitdiff
path: root/test/TestHalfTensor.hpp
blob: 2b7870f42e43da4823d92c54fb0821eeadcb5147 (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
34
35
36
37
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