aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/test/TestLayerVisitor.hpp
blob: eaf1667800f2c19cb299ab73d22f7c8b60e2289a (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
39
40
41
42
43
44
45
46
47
48
49
50
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once

#include <armnn/StrategyBase.hpp>
#include <armnn/Descriptors.hpp>
#include <backendsCommon/TensorHandle.hpp>

namespace armnn
{
// Abstract base class with do nothing implementations for all layers
class TestLayerVisitor : public StrategyBase<NoThrowStrategy>
{
protected:
    virtual ~TestLayerVisitor() {}

    void CheckLayerName(const char* name);

    void CheckLayerPointer(const IConnectableLayer* layer);

    void CheckConstTensors(const ConstTensor& expected,
                           const ConstTensor& actual);
    void CheckConstTensors(const ConstTensor& expected,
                           const ConstTensorHandle& actual);

    void CheckConstTensorPtrs(const std::string& name,
                              const ConstTensor* expected,
                              const ConstTensor* actual);
    void CheckConstTensorPtrs(const std::string& name,
                              const ConstTensor* expected,
                              const std::shared_ptr<ConstTensorHandle> actual);

    void CheckOptionalConstTensors(const Optional<ConstTensor>& expected, const Optional<ConstTensor>& actual);

private:
    const char* m_LayerName;

public:
    explicit TestLayerVisitor(const char* name) : m_LayerName(name)
    {
        if (name == nullptr)
        {
            m_LayerName = "";
        }
    }
};

} //namespace armnn