Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 1 | /* |
Anthony Barbier | 1c0d0ff | 2018-01-31 13:05:09 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 ARM Limited. |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +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/core/Types.h" |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 25 | #include "arm_compute/runtime/NEON/functions/NEDepthConcatenateLayer.h" |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 26 | #include "arm_compute/runtime/Tensor.h" |
| 27 | #include "arm_compute/runtime/TensorAllocator.h" |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 28 | #include "tests/NEON/Accessor.h" |
Moritz Pflanzer | a09de0c | 2017-09-01 20:41:12 +0100 | [diff] [blame] | 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 | #include "tests/validation/fixtures/DepthConcatenateLayerFixture.h" |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 35 | |
| 36 | namespace arm_compute |
| 37 | { |
| 38 | namespace test |
| 39 | { |
| 40 | namespace validation |
| 41 | { |
| 42 | TEST_SUITE(NEON) |
| 43 | TEST_SUITE(DepthConcatenateLayer) |
| 44 | |
Georgios Pinitas | 88627fb | 2018-02-26 20:33:40 +0000 | [diff] [blame] | 45 | TEST_CASE(Configuration, framework::DatasetMode::ALL) |
| 46 | { |
| 47 | // Create tensors |
| 48 | Tensor src1 = create_tensor<Tensor>(TensorShape(32U, 32U, 128U), DataType::F32, 1); |
| 49 | Tensor src2 = create_tensor<Tensor>(TensorShape(32U, 32U, 32U), DataType::F32, 1); |
| 50 | Tensor dst; |
| 51 | |
| 52 | ARM_COMPUTE_EXPECT(src1.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 53 | ARM_COMPUTE_EXPECT(src2.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 54 | ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |
| 55 | |
| 56 | // Create and configure function |
| 57 | NEDepthConcatenateLayer concat_layer; |
| 58 | |
| 59 | concat_layer.configure({ &src1, &src2 }, &dst); |
| 60 | |
| 61 | // Validate valid region |
| 62 | const ValidRegion valid_region = shape_to_valid_region(TensorShape(32U, 32U, 160U)); |
| 63 | validate(dst.info()->valid_region(), valid_region); |
| 64 | } |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 65 | |
| 66 | template <typename T> |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 67 | using NEDepthConcatenateLayerFixture = DepthConcatenateLayerValidationFixture<Tensor, ITensor, Accessor, NEDepthConcatenateLayer, T>; |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 68 | |
| 69 | TEST_SUITE(Float) |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 70 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 71 | TEST_SUITE(FP16) |
Georgios Pinitas | 583137c | 2017-08-31 18:12:42 +0100 | [diff] [blame] | 72 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConcatenateLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", |
| 73 | DataType::F16))) |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 74 | { |
| 75 | // Validate output |
| 76 | validate(Accessor(_target), _reference); |
| 77 | } |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 78 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConcatenateLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(), framework::dataset::make("DataType", |
Georgios Pinitas | 583137c | 2017-08-31 18:12:42 +0100 | [diff] [blame] | 79 | DataType::F16))) |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 80 | { |
| 81 | // Validate output |
| 82 | validate(Accessor(_target), _reference); |
| 83 | } |
| 84 | TEST_SUITE_END() |
Ioan-Cristian Szabo | 5edbd1c | 2017-11-13 13:34:08 +0000 | [diff] [blame] | 85 | #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 86 | |
| 87 | TEST_SUITE(FP32) |
| 88 | FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConcatenateLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType", |
| 89 | DataType::F32))) |
| 90 | { |
| 91 | // Validate output |
| 92 | validate(Accessor(_target), _reference); |
| 93 | } |
Giorgio Arena | 04a8f8c | 2017-11-23 11:45:24 +0000 | [diff] [blame] | 94 | FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConcatenateLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(), framework::dataset::make("DataType", |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 95 | DataType::F32))) |
| 96 | { |
| 97 | // Validate output |
| 98 | validate(Accessor(_target), _reference); |
| 99 | } |
| 100 | TEST_SUITE_END() |
| 101 | TEST_SUITE_END() |
| 102 | |
Moritz Pflanzer | 3ce3ff4 | 2017-07-21 17:41:02 +0100 | [diff] [blame] | 103 | TEST_SUITE_END() |
| 104 | TEST_SUITE_END() |
| 105 | } // namespace validation |
| 106 | } // namespace test |
| 107 | } // namespace arm_compute |