aboutsummaryrefslogtreecommitdiff
path: root/delegate/test/SqueezeTest.cpp
blob: 9d0e748ce05306135b62be0f8642ab404656655d (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// Copyright © 2023-2024 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "RedefineTestHelper.hpp"

#include <doctest/doctest.h>

namespace armnnDelegate
{

void SqueezeSimpleTest()
{
    // Set input data
    std::vector<int32_t> inputShape  { 1, 2, 2, 1 };
    std::vector<int32_t> outputShape { 2, 2 };
    std::vector<int32_t> squeezeDims { };

    std::vector<float> inputValues = { 1, 2, 3, 4 };
    std::vector<float> expectedOutputValues = { 1, 2, 3, 4 };

    RedefineTest<float>(tflite::BuiltinOperator_SQUEEZE,
                        ::tflite::TensorType_FLOAT32,
                        inputShape,
                        outputShape,
                        inputValues,
                        expectedOutputValues,
                        squeezeDims);
}

void SqueezeWithDimsTest()
{
    // Set input data
    std::vector<int32_t> inputShape  { 1, 2, 2, 1 };
    std::vector<int32_t> outputShape { 1, 2, 2 };
    std::vector<int32_t> squeezeDims { -1 };

    std::vector<float> inputValues = { 1, 2, 3, 4 };
    std::vector<float> expectedOutputValues = { 1, 2, 3, 4 };

    RedefineTest<float>(tflite::BuiltinOperator_SQUEEZE,
                        ::tflite::TensorType_FLOAT32,
                        inputShape,
                        outputShape,
                        inputValues,
                        expectedOutputValues,
                        squeezeDims);
}

TEST_SUITE("SqueezeTests")
{

TEST_CASE ("Squeeze_Simple_Test")
{
    SqueezeSimpleTest();
}

TEST_CASE ("Squeeze_With_Dims_Test")
{
    SqueezeWithDimsTest();
}

} // TEST_SUITE("SqueezeTests")

} // namespace armnnDelegate