xref: /aosp_15_r20/external/armnn/delegate/test/ShapeTest.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2021, 2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ShapeTestHelper.hpp"
7 
8 #include <doctest/doctest.h>
9 
10 namespace armnnDelegate
11 {
12 
ShapeSimpleTest(std::vector<armnn::BackendId> & backends)13 void ShapeSimpleTest(std::vector<armnn::BackendId>& backends)
14 {
15     std::vector<int32_t> inputShape{ 1, 3, 2, 3 };
16 
17     std::vector<int32_t> inputValues{ 1, 1, 1, 1, 1, 1, 1, 1,
18                                       1, 1, 1, 1, 1, 1, 1, 1, };
19 
20     std::vector<int32_t> expectedOutputShape{ 4 };
21     std::vector<int32_t> expectedOutputValues{ 1, 3, 2, 3 };
22 
23     ShapeTest<int32_t, int32_t>(::tflite::TensorType_INT32,
24                                 ::tflite::TensorType_INT32,
25                                 backends,
26                                 inputShape,
27                                 inputValues,
28                                 expectedOutputValues,
29                                 expectedOutputShape);
30 }
31 
32 // SHAPE Test Suite
33 TEST_SUITE("SHAPE_CpuRefTests")
34 {
35 
36 TEST_CASE("SHAPE_Simple_CpuRef_Test")
37 {
38     std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
39     ShapeSimpleTest(backends);
40 }
41 
42 }
43 // End of SHAPE Test Suite
44 
45 } // namespace armnnDelegate