blob: 9d0e748ce05306135b62be0f8642ab404656655d [file] [log] [blame]
Matthew Sloyan3504e422023-05-03 13:53:02 +01001//
Colm Donelan7bcae3c2024-01-22 10:07:14 +00002// Copyright © 2023-2024 Arm Ltd and Contributors. All rights reserved.
Matthew Sloyan3504e422023-05-03 13:53:02 +01003// SPDX-License-Identifier: MIT
4//
5
6#include "RedefineTestHelper.hpp"
7
Colm Donelan7bcae3c2024-01-22 10:07:14 +00008#include <doctest/doctest.h>
9
Matthew Sloyan3504e422023-05-03 13:53:02 +010010namespace armnnDelegate
11{
12
Colm Donelan7bcae3c2024-01-22 10:07:14 +000013void SqueezeSimpleTest()
Matthew Sloyan3504e422023-05-03 13:53:02 +010014{
15 // Set input data
16 std::vector<int32_t> inputShape { 1, 2, 2, 1 };
17 std::vector<int32_t> outputShape { 2, 2 };
18 std::vector<int32_t> squeezeDims { };
19
20 std::vector<float> inputValues = { 1, 2, 3, 4 };
21 std::vector<float> expectedOutputValues = { 1, 2, 3, 4 };
22
23 RedefineTest<float>(tflite::BuiltinOperator_SQUEEZE,
24 ::tflite::TensorType_FLOAT32,
Matthew Sloyan3504e422023-05-03 13:53:02 +010025 inputShape,
26 outputShape,
27 inputValues,
28 expectedOutputValues,
29 squeezeDims);
30}
31
Colm Donelan7bcae3c2024-01-22 10:07:14 +000032void SqueezeWithDimsTest()
Matthew Sloyan3504e422023-05-03 13:53:02 +010033{
34 // Set input data
35 std::vector<int32_t> inputShape { 1, 2, 2, 1 };
36 std::vector<int32_t> outputShape { 1, 2, 2 };
37 std::vector<int32_t> squeezeDims { -1 };
38
39 std::vector<float> inputValues = { 1, 2, 3, 4 };
40 std::vector<float> expectedOutputValues = { 1, 2, 3, 4 };
41
42 RedefineTest<float>(tflite::BuiltinOperator_SQUEEZE,
43 ::tflite::TensorType_FLOAT32,
Matthew Sloyan3504e422023-05-03 13:53:02 +010044 inputShape,
45 outputShape,
46 inputValues,
47 expectedOutputValues,
48 squeezeDims);
49}
50
Colm Donelan7bcae3c2024-01-22 10:07:14 +000051TEST_SUITE("SqueezeTests")
Matthew Sloyan3504e422023-05-03 13:53:02 +010052{
53
Colm Donelan7bcae3c2024-01-22 10:07:14 +000054TEST_CASE ("Squeeze_Simple_Test")
Matthew Sloyan3504e422023-05-03 13:53:02 +010055{
Colm Donelan7bcae3c2024-01-22 10:07:14 +000056 SqueezeSimpleTest();
Matthew Sloyan3504e422023-05-03 13:53:02 +010057}
58
Colm Donelan7bcae3c2024-01-22 10:07:14 +000059TEST_CASE ("Squeeze_With_Dims_Test")
Matthew Sloyan3504e422023-05-03 13:53:02 +010060{
Colm Donelan7bcae3c2024-01-22 10:07:14 +000061 SqueezeWithDimsTest();
Matthew Sloyan3504e422023-05-03 13:53:02 +010062}
63
Colm Donelan7bcae3c2024-01-22 10:07:14 +000064} // TEST_SUITE("SqueezeTests")
Matthew Sloyan3504e422023-05-03 13:53:02 +010065
66} // namespace armnnDelegate