John Richardson | 6f4d49f | 2017-09-07 11:21:10 +0100 | [diff] [blame] | 1 | /* |
Michalis Spyrou | d175ece | 2020-07-30 23:39:32 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2020 Arm Limited. |
John Richardson | 6f4d49f | 2017-09-07 11:21:10 +0100 | [diff] [blame] | 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/runtime/CL/functions/CLNonLinearFilter.h" |
| 25 | #include "tests/CL/CLAccessor.h" |
| 26 | #include "tests/PaddingCalculator.h" |
| 27 | #include "tests/datasets/BorderModeDataset.h" |
| 28 | #include "tests/datasets/MatrixPatternDataset.h" |
| 29 | #include "tests/datasets/NonLinearFilterFunctionDataset.h" |
| 30 | #include "tests/datasets/ShapeDatasets.h" |
| 31 | #include "tests/framework/Macros.h" |
| 32 | #include "tests/validation/Validation.h" |
| 33 | #include "tests/validation/fixtures/NonLinearFilterFixture.h" |
| 34 | |
| 35 | namespace arm_compute |
| 36 | { |
| 37 | namespace test |
| 38 | { |
| 39 | namespace validation |
| 40 | { |
| 41 | TEST_SUITE(CL) |
| 42 | TEST_SUITE(NonLinearFilter) |
| 43 | |
John Richardson | 6f4d49f | 2017-09-07 11:21:10 +0100 | [diff] [blame] | 44 | template <typename T> |
| 45 | using CLNonLinearFilterFixture = NonLinearFilterValidationFixture<CLTensor, CLAccessor, CLNonLinearFilter, T>; |
| 46 | |
| 47 | FIXTURE_DATA_TEST_CASE(RunSmall, CLNonLinearFilterFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallShapes(), |
| 48 | datasets::NonLinearFilterFunctions()), |
| 49 | framework::dataset::make("MaskSize", { 3U, 5U })), |
| 50 | datasets::MatrixPatterns()), |
| 51 | datasets::BorderModes()), |
| 52 | framework::dataset::make("DataType", DataType::U8))) |
| 53 | { |
| 54 | // Validate output |
| 55 | validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), _border_size)); |
| 56 | } |
| 57 | |
| 58 | FIXTURE_DATA_TEST_CASE(RunLarge, CLNonLinearFilterFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeShapes(), |
| 59 | datasets::NonLinearFilterFunctions()), |
| 60 | framework::dataset::make("MaskSize", { 3U, 5U })), |
| 61 | datasets::MatrixPatterns()), |
| 62 | datasets::BorderModes()), |
| 63 | framework::dataset::make("DataType", DataType::U8))) |
| 64 | { |
| 65 | // Validate output |
| 66 | validate(CLAccessor(_target), _reference, shape_to_valid_region(_reference.shape(), (_border_mode == BorderMode::UNDEFINED), _border_size)); |
| 67 | } |
| 68 | |
| 69 | TEST_SUITE_END() |
| 70 | TEST_SUITE_END() |
| 71 | } // namespace validation |
| 72 | } // namespace test |
| 73 | } // namespace arm_compute |