xref: /aosp_15_r20/external/ComputeLibrary/tests/validation/CL/HeightConcatenateLayer.cpp (revision c217d954acce2dbc11938adb493fc0abd69584f3)
1 /*
2  * Copyright (c) 2019 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #include "arm_compute/core/Types.h"
25 #include "arm_compute/runtime/CL/CLTensor.h"
26 #include "arm_compute/runtime/CL/CLTensorAllocator.h"
27 #include "arm_compute/runtime/CL/functions/CLConcatenateLayer.h"
28 #include "tests/CL/CLAccessor.h"
29 #include "tests/datasets/ShapeDatasets.h"
30 #include "tests/framework/Asserts.h"
31 #include "tests/framework/Macros.h"
32 #include "tests/framework/datasets/Datasets.h"
33 #include "tests/validation/Validation.h"
34 
35 #include "tests/validation/fixtures/ConcatenateLayerFixture.h"
36 
37 namespace arm_compute
38 {
39 namespace test
40 {
41 namespace validation
42 {
43 TEST_SUITE(CL)
44 TEST_SUITE(HeightConcatenateLayer)
45 
46 template <typename T>
47 using CLHeightConcatenateLayerFixture = ConcatenateLayerValidationFixture<CLTensor, ICLTensor, CLAccessor, CLConcatenateLayer, T>;
48 
49 TEST_SUITE(Float)
TEST_SUITE(FP16)50 TEST_SUITE(FP16)
51 FIXTURE_DATA_TEST_CASE(RunSmall, CLHeightConcatenateLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(concat(datasets::Small2DShapes(), datasets::Tiny4DShapes()),
52                                                                                                                    framework::dataset::make("DataType",
53                                                                                                                            DataType::F16)),
54                                                                                                                    framework::dataset::make("Axis", 1)))
55 
56 {
57     // Validate output
58     validate(CLAccessor(_target), _reference);
59 }
60 FIXTURE_DATA_TEST_CASE(RunLarge, CLHeightConcatenateLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(concat(datasets::Large2DShapes(), datasets::Small4DShapes()),
61                                                                                                                  framework::dataset::make("DataType",
62                                                                                                                          DataType::F16)),
63                                                                                                                  framework::dataset::make("Axis", 1)))
64 
65 {
66     // Validate output
67     validate(CLAccessor(_target), _reference);
68 }
69 TEST_SUITE_END()
70 
TEST_SUITE(FP32)71 TEST_SUITE(FP32)
72 FIXTURE_DATA_TEST_CASE(RunSmall, CLHeightConcatenateLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(concat(datasets::Small2DShapes(), datasets::Tiny4DShapes()),
73                                                                                                                     framework::dataset::make("DataType",
74                                                                                                                             DataType::F32)),
75                                                                                                                     framework::dataset::make("Axis", 1)))
76 
77 {
78     // Validate output
79     validate(CLAccessor(_target), _reference);
80 }
81 FIXTURE_DATA_TEST_CASE(RunLarge, CLHeightConcatenateLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::ConcatenateLayerShapes(), framework::dataset::make("DataType",
82                                                                                                                   DataType::F32)),
83                                                                                                                   framework::dataset::make("Axis", 1)))
84 
85 {
86     // Validate output
87     validate(CLAccessor(_target), _reference);
88 }
89 TEST_SUITE_END()
TEST_SUITE_END()90 TEST_SUITE_END()
91 
92 TEST_SUITE(Quantized)
93 TEST_SUITE(QASYMM8)
94 FIXTURE_DATA_TEST_CASE(RunSmall, CLHeightConcatenateLayerFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(concat(datasets::Small2DShapes(), datasets::Tiny4DShapes()),
95                                                                                                                       framework::dataset::make("DataType",
96                                                                                                                               DataType::QASYMM8)),
97                                                                                                                       framework::dataset::make("Axis", 1)))
98 
99 {
100     // Validate output
101     validate(CLAccessor(_target), _reference);
102 }
103 FIXTURE_DATA_TEST_CASE(RunLarge, CLHeightConcatenateLayerFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::ConcatenateLayerShapes(), framework::dataset::make("DataType",
104                                                                                                                     DataType::QASYMM8)),
105                                                                                                                     framework::dataset::make("Axis", 1)))
106 
107 {
108     // Validate output
109     validate(CLAccessor(_target), _reference);
110 }
111 TEST_SUITE_END()
112 TEST_SUITE_END()
113 
114 TEST_SUITE_END()
115 TEST_SUITE_END()
116 } // namespace validation
117 } // namespace test
118 } // namespace arm_compute
119