blob: a78b27edc2f68f2f39f8e00898364d41278829e9 [file] [log] [blame]
Anthony Barbier7068f992017-10-26 15:23:08 +01001/*
2 * Copyright (c) 2017 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
25#include "arm_compute/core/Types.h"
26#include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h"
27#include "arm_compute/runtime/GLES_COMPUTE/GCTensorAllocator.h"
28#include "arm_compute/runtime/GLES_COMPUTE/functions/GCPoolingLayer.h"
29#include "tests/GLES_COMPUTE/GCAccessor.h"
30#include "tests/PaddingCalculator.h"
31#include "tests/datasets/PoolingTypesDataset.h"
32#include "tests/datasets/ShapeDatasets.h"
33#include "tests/framework/Asserts.h"
34#include "tests/framework/Macros.h"
35#include "tests/framework/datasets/Datasets.h"
36#include "tests/validation/Validation.h"
37#include "tests/validation/fixtures/PoolingLayerFixture.h"
38
39namespace arm_compute
40{
41namespace test
42{
43namespace validation
44{
45namespace
46{
47// FIXME(APPBROWSER-304): Add exclude padding support for OpenGL ES implementation
48/** Input data set for float data types */
49const auto PoolingLayerDatasetFP = combine(combine(combine(datasets::PoolingTypes(), framework::dataset::make("PoolingSize", { 2, 3, 4, 7, 9 })),
50 framework::dataset::make("PadStride", { PadStrideInfo(1, 1, 0, 0), PadStrideInfo(2, 1, 0, 0), PadStrideInfo(1, 2, 1, 1), PadStrideInfo(2, 2, 1, 0) })),
51 framework::dataset::make("ExcludePadding", { /* true, */ false }));
52
53// FIXME(APPBROWSER-304): Add exclude padding support for OpenGL ES implementation
54// constexpr AbsoluteTolerance<float> tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for float types */
55// constexpr AbsoluteTolerance<float> tolerance_f16(0.01f); /**< Tolerance value for comparing reference's output against implementation's output for float types */
56
57} // namespace
58
59TEST_SUITE(GC)
60TEST_SUITE(PoolingLayer)
61
62template <typename T>
63using GCPoolingLayerFixture = PoolingLayerValidationFixture<GCTensor, GCAccessor, GCPoolingLayer, T>;
64
65TEST_SUITE(Float)
66TEST_SUITE(FP32)
67FIXTURE_DATA_TEST_CASE(RunSmall, GCPoolingLayerFixture<float>, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), combine(PoolingLayerDatasetFP, framework::dataset::make("DataType",
68 DataType::F32))))
69{
70 // FIXME(APPBROWSER-304): Add exclude padding support for OpenGL ES implementation
71 // Validate output
72 // validate(GCAccessor(_target), _reference, tolerance_f32);
73}
74FIXTURE_DATA_TEST_CASE(RunLarge, GCPoolingLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), combine(PoolingLayerDatasetFP, framework::dataset::make("DataType",
75 DataType::F32))))
76{
77 // FIXME(APPBROWSER-304): Add exclude padding support for OpenGL ES implementation
78 // Validate output
79 // validate(GCAccessor(_target), _reference, tolerance_f32);
80}
81TEST_SUITE_END()
82
83TEST_SUITE(FP16)
84FIXTURE_DATA_TEST_CASE(RunSmall, GCPoolingLayerFixture<half_float::half>, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), combine(PoolingLayerDatasetFP,
85 framework::dataset::make("DataType", DataType::F16))))
86{
87 // FIXME(APPBROWSER-304): Add exclude padding support for OpenGL ES implementation
88 // Validate output
89 // validate(GCAccessor(_target), _reference, tolerance_f16);
90}
91FIXTURE_DATA_TEST_CASE(RunLarge, GCPoolingLayerFixture<half_float::half>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeShapes(), combine(PoolingLayerDatasetFP,
92 framework::dataset::make("DataType", DataType::F16))))
93{
94 // FIXME(APPBROWSER-304): Add exclude padding support for OpenGL ES implementation
95 // Validate output
96 // validate(GCAccessor(_target), _reference, tolerance_f16);
97}
98TEST_SUITE_END()
99TEST_SUITE_END()
100
101TEST_SUITE_END()
102TEST_SUITE_END()
103} // namespace validation
104} // namespace test
105} // namespace arm_compute