blob: 0e0b674e41d54b42365d7c358ff406a0184c1229 [file] [log] [blame]
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +01001/*
Anthony Barbier1c0d0ff2018-01-31 13:05:09 +00002 * Copyright (c) 2017-2018 ARM Limited.
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +01003 *
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 Arena04a8f8c2017-11-23 11:45:24 +000025#include "arm_compute/runtime/NEON/functions/NEDepthConcatenateLayer.h"
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010026#include "arm_compute/runtime/Tensor.h"
27#include "arm_compute/runtime/TensorAllocator.h"
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010028#include "tests/NEON/Accessor.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010029#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 Pflanzer3ce3ff42017-07-21 17:41:02 +010035
36namespace arm_compute
37{
38namespace test
39{
40namespace validation
41{
42TEST_SUITE(NEON)
43TEST_SUITE(DepthConcatenateLayer)
44
Georgios Pinitas88627fb2018-02-26 20:33:40 +000045TEST_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 Pflanzer3ce3ff42017-07-21 17:41:02 +010065
66template <typename T>
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000067using NEDepthConcatenateLayerFixture = DepthConcatenateLayerValidationFixture<Tensor, ITensor, Accessor, NEDepthConcatenateLayer, T>;
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010068
69TEST_SUITE(Float)
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +000070#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010071TEST_SUITE(FP16)
Georgios Pinitas583137c2017-08-31 18:12:42 +010072FIXTURE_DATA_TEST_CASE(RunSmall, NEDepthConcatenateLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::Small2DShapes(), framework::dataset::make("DataType",
73 DataType::F16)))
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010074{
75 // Validate output
76 validate(Accessor(_target), _reference);
77}
Giorgio Arena04a8f8c2017-11-23 11:45:24 +000078FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConcatenateLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(), framework::dataset::make("DataType",
Georgios Pinitas583137c2017-08-31 18:12:42 +010079 DataType::F16)))
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010080{
81 // Validate output
82 validate(Accessor(_target), _reference);
83}
84TEST_SUITE_END()
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +000085#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010086
87TEST_SUITE(FP32)
88FIXTURE_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 Arena04a8f8c2017-11-23 11:45:24 +000094FIXTURE_DATA_TEST_CASE(RunLarge, NEDepthConcatenateLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::DepthConcatenateLayerShapes(), framework::dataset::make("DataType",
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +010095 DataType::F32)))
96{
97 // Validate output
98 validate(Accessor(_target), _reference);
99}
100TEST_SUITE_END()
101TEST_SUITE_END()
102
Moritz Pflanzer3ce3ff42017-07-21 17:41:02 +0100103TEST_SUITE_END()
104TEST_SUITE_END()
105} // namespace validation
106} // namespace test
107} // namespace arm_compute