blob: 1fea5c1111f89e708951d3bc31596949ac16ad29 [file] [log] [blame]
Michele Di Giorgio980002b2018-08-08 09:25:51 +01001/*
2 * Copyright (c) 2018 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/CL/kernels/CLCol2ImKernel.h"
25#include "arm_compute/core/Types.h"
26#include "tests/CL/Helper.h"
27
28#include "tests/CL/CLAccessor.h"
29#include "tests/datasets/Col2ImLayerDataset.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#include "tests/validation/fixtures/Col2ImFixture.h"
35
36namespace arm_compute
37{
38namespace test
39{
40namespace validation
41{
42TEST_SUITE(CL)
43TEST_SUITE(Col2Im)
44
45using CLCol2Im = CLSynthetizeFunction<CLCol2ImKernel>;
46
47// *INDENT-OFF*
48// clang-format off
49DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(
50 framework::dataset::make("InputInfo", { TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::S64), // Unsupported data type
51 TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32), // Mismatching data type
52 TensorInfo(TensorShape(10U, 12U, 1U, 2U), 1, DataType::F32), // Invalid output shape
53 TensorInfo(TensorShape(3U, 12U, 4U, 2U), 1, DataType::F32),
54 }),
55 framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
56 TensorInfo(TensorShape(3U, 4U, 10U, 2U), 1, DataType::F16),
57 TensorInfo(TensorShape(3U, 3U, 10U, 2U), 1, DataType::F32),
58 TensorInfo(TensorShape(3U, 4U, 12U, 2U), 1, DataType::F32),
59 })),
60 framework::dataset::make("ConvolvedWidth", { 3, 3, 3, 3 })),
61 framework::dataset::make("ConvolvedHeight", { 4, 4, 4, 4 })),
62 framework::dataset::make("NumGroups", { 1, 1, 1, 4 })),
63 framework::dataset::make("Expected", { false, false, false, true })),
64 input_info, output_info, convolved_width, convolved_height, num_groups, expected)
65{
Giorgio Arena226e4b92018-08-23 12:00:02 +010066 bool status = bool(CLCol2Im::validate(&input_info, &output_info, Size2D(convolved_width, convolved_height), num_groups));
Michele Di Giorgio980002b2018-08-08 09:25:51 +010067 ARM_COMPUTE_EXPECT(status == expected, framework::LogLevel::ERRORS);
68}
69// clang-format on
70// *INDENT-ON*
71
72template <typename T>
Giorgio Arena226e4b92018-08-23 12:00:02 +010073using CLCol2ImFixture = Col2ImValidationFixture<CLTensor, CLAccessor, CLCol2Im, T, true>;
Michele Di Giorgio980002b2018-08-08 09:25:51 +010074
75TEST_SUITE(Float)
76TEST_SUITE(FP32)
77FIXTURE_DATA_TEST_CASE(RunSmall, CLCol2ImFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGroupedCol2ImLayerDataset(), framework::dataset::make("DataType", DataType::F32)))
78{
79 // Validate output
80 validate(CLAccessor(_target), _reference);
81}
82
83FIXTURE_DATA_TEST_CASE(RunLarge, CLCol2ImFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGroupedCol2ImLayerDataset(), framework::dataset::make("DataType", DataType::F32)))
84{
85 // Validate output
86 validate(CLAccessor(_target), _reference);
87}
88TEST_SUITE_END()
89
90TEST_SUITE(FP16)
91FIXTURE_DATA_TEST_CASE(RunSmall, CLCol2ImFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGroupedCol2ImLayerDataset(), framework::dataset::make("DataType", DataType::F16)))
92{
93 // Validate output
94 validate(CLAccessor(_target), _reference);
95}
96
97FIXTURE_DATA_TEST_CASE(RunLarge, CLCol2ImFixture<half>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGroupedCol2ImLayerDataset(), framework::dataset::make("DataType", DataType::F16)))
98{
99 // Validate output
100 validate(CLAccessor(_target), _reference);
101}
102TEST_SUITE_END()
103
104TEST_SUITE_END()
105
106TEST_SUITE(QASYMM8)
107FIXTURE_DATA_TEST_CASE(RunSmall, CLCol2ImFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGroupedCol2ImLayerDataset(), framework::dataset::make("DataType",
108 DataType::QASYMM8)))
109{
110 // Validate output
111 validate(CLAccessor(_target), _reference);
112}
113
114FIXTURE_DATA_TEST_CASE(RunLarge, CLCol2ImFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGroupedCol2ImLayerDataset(), framework::dataset::make("DataType",
115 DataType::QASYMM8)))
116{
117 // Validate output
118 validate(CLAccessor(_target), _reference);
119}
120TEST_SUITE_END()
121
122TEST_SUITE_END()
123TEST_SUITE_END()
124} // namespace validation
125} // namespace test
126} // namespace arm_compute