Manuel Bottini | 9032ee3 | 2019-08-07 17:04:11 +0100 | [diff] [blame] | 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/NEON/functions/NEPadLayer.h" |
| 26 | #include "arm_compute/runtime/Tensor.h" |
| 27 | #include "arm_compute/runtime/TensorAllocator.h" |
| 28 | #include "tests/NEON/Accessor.h" |
| 29 | #include "tests/benchmark/fixtures/PadLayerFixture.h" |
| 30 | #include "tests/datasets/ShapeDatasets.h" |
| 31 | #include "tests/datasets/SplitDataset.h" |
| 32 | #include "tests/framework/Asserts.h" |
| 33 | #include "tests/framework/Macros.h" |
| 34 | |
| 35 | namespace arm_compute |
| 36 | { |
| 37 | namespace test |
| 38 | { |
| 39 | namespace benchmark |
| 40 | { |
| 41 | namespace |
| 42 | { |
| 43 | const auto Fssd_25_8bit_ShapesDataset = framework::dataset::make("TensorShape", |
| 44 | { |
| 45 | TensorShape{ 320U, 320U, 3U }, |
| 46 | TensorShape{ 160U, 160U, 16U }, |
| 47 | TensorShape{ 80U, 80U, 32U }, |
| 48 | TensorShape{ 40U, 40U, 64U }, |
| 49 | TensorShape{ 20U, 20U, 128U }, |
| 50 | TensorShape{ 10U, 10U, 256U }, |
| 51 | TensorShape{ 10U, 10U, 64U }, |
| 52 | TensorShape{ 5U, 5U, 32U }, |
| 53 | TensorShape{ 3U, 3U, 32U }, |
| 54 | TensorShape{ 2U, 2U, 32U } |
| 55 | }); |
| 56 | |
| 57 | const auto PaddingSizesDataset = framework::dataset::make("PaddingSize", |
| 58 | { |
| 59 | PaddingList{ { 1, 1 }, { 1, 1 } }, |
| 60 | }); |
| 61 | } // namespace |
| 62 | |
| 63 | TEST_SUITE(NEON) |
| 64 | TEST_SUITE(PadLayer) |
| 65 | |
| 66 | template <typename T> |
| 67 | using NEPaddingFixture = PaddingFixture<Tensor, Accessor, NEPadLayer, T>; |
| 68 | |
| 69 | REGISTER_FIXTURE_DATA_TEST_CASE(RunF32, NEPaddingFixture<float>, framework::DatasetMode::ALL, |
| 70 | combine(combine(combine( |
| 71 | Fssd_25_8bit_ShapesDataset, |
| 72 | framework::dataset::make("DataType", { DataType::F32 })), |
| 73 | PaddingSizesDataset), |
| 74 | framework::dataset::make("PaddingMode", { PaddingMode::CONSTANT, PaddingMode::REFLECT }))); |
| 75 | |
| 76 | REGISTER_FIXTURE_DATA_TEST_CASE(RunQASYMM8, NEPaddingFixture<uint8_t>, framework::DatasetMode::ALL, |
| 77 | combine(combine(combine( |
| 78 | Fssd_25_8bit_ShapesDataset, |
| 79 | framework::dataset::make("DataType", { DataType::QASYMM8 })), |
| 80 | PaddingSizesDataset), |
| 81 | framework::dataset::make("PaddingMode", { PaddingMode::CONSTANT, PaddingMode::REFLECT }))); |
| 82 | |
| 83 | TEST_SUITE_END() // PadLayer |
| 84 | TEST_SUITE_END() // NEON |
| 85 | } // namespace benchmark |
| 86 | } // namespace test |
| 87 | } // namespace arm_compute |