blob: 67b948568f2c8426fd764d5f84531f3b306aa6e8 [file] [log] [blame]
Moritz Pflanzeree493ae2017-07-05 10:52:21 +01001/*
Georgios Pinitas51a67302018-01-17 12:55:26 +00002 * Copyright (c) 2017-2018 ARM Limited.
Moritz Pflanzeree493ae2017-07-05 10:52:21 +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/TensorShape.h"
25#include "arm_compute/core/Types.h"
26#include "arm_compute/runtime/NEON/functions/NEDirectConvolutionLayer.h"
27#include "arm_compute/runtime/Tensor.h"
28#include "arm_compute/runtime/TensorAllocator.h"
Moritz Pflanzerd58cec02017-07-18 15:44:21 +010029#include "tests/NEON/Accessor.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010030#include "tests/benchmark/fixtures/ConvolutionLayerFixture.h"
31#include "tests/datasets/DirectConvolutionLayerDataset.h"
32#include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h"
33#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h"
34#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h"
35#include "tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h"
36#include "tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h"
37#include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h"
38#include "tests/framework/Macros.h"
39#include "tests/framework/datasets/Datasets.h"
Anthony Barbier2a07e182017-08-04 18:20:27 +010040#include "utils/TypePrinter.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010041
42namespace arm_compute
43{
44namespace test
45{
Michalis Spyrou724079d2017-12-15 11:37:37 +000046namespace benchmark
47{
Pablo Tello0d176142017-07-06 16:43:14 +010048namespace
49{
Giorgio Arena7d6bf6a2017-11-01 14:59:30 +000050// Special data types for networks that need 5x5 direct convolution, which does not support Fixed Point
steniu01a629da12017-07-28 14:40:58 +010051#ifdef ARM_COMPUTE_ENABLE_F16
Georgios Pinitas51a67302018-01-17 12:55:26 +000052const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 });
steniu01a629da12017-07-28 14:40:58 +010053#else /* ARM_COMPUTE_ENABLE_F16 */
Georgios Pinitas51a67302018-01-17 12:55:26 +000054const auto data_types = framework::dataset::make("DataType", { DataType::F32 });
steniu01a629da12017-07-28 14:40:58 +010055#endif /* ARM_COMPUTE_ENABLE_F16 */
Pablo Tello0d176142017-07-06 16:43:14 +010056} // namespace
57
steniu01a629da12017-07-28 14:40:58 +010058using NEConvolutionLayerFixture = ConvolutionLayerFixture<Tensor, NEDirectConvolutionLayer, Accessor>;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010059
60TEST_SUITE(NEON)
61
Georgios Pinitas898a8062017-09-12 19:19:12 +010062REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL,
Georgios Pinitas51a67302018-01-17 12:55:26 +000063 framework::dataset::combine(framework::dataset::combine(datasets::AlexNetDirectConvolutionLayerDataset(), data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010064 framework::dataset::make("Batches", 1)));
steniu01a629da12017-07-28 14:40:58 +010065
Georgios Pinitas898a8062017-09-12 19:19:12 +010066REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1DirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL,
Georgios Pinitas51a67302018-01-17 12:55:26 +000067 framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1DirectConvolutionLayerDataset(), data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010068 framework::dataset::make("Batches", 1)));
steniu01a629da12017-07-28 14:40:58 +010069
Georgios Pinitas898a8062017-09-12 19:19:12 +010070REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4DirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL,
71 framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4DirectConvolutionLayerDataset(), data_types),
72 framework::dataset::make("Batches", 1)));
SiCong Lif583fb72017-08-15 15:09:18 +010073
Georgios Pinitas898a8062017-09-12 19:19:12 +010074REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL,
75 framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), data_types),
76 framework::dataset::make("Batches", 1)));
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010077
SiCong Li1e5c1572017-07-27 17:58:52 +010078TEST_SUITE(NIGHTLY)
Georgios Pinitas898a8062017-09-12 19:19:12 +010079REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Georgios Pinitas51a67302018-01-17 12:55:26 +000080 framework::dataset::combine(framework::dataset::combine(datasets::AlexNetDirectConvolutionLayerDataset(), data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010081 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +010082
Georgios Pinitas898a8062017-09-12 19:19:12 +010083REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1DirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Georgios Pinitas51a67302018-01-17 12:55:26 +000084 framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1DirectConvolutionLayerDataset(), data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010085 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +010086
Georgios Pinitas898a8062017-09-12 19:19:12 +010087REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4DirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
88 framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4DirectConvolutionLayerDataset(), data_types),
89 framework::dataset::make("Batches", { 4, 8 })));
SiCong Lif583fb72017-08-15 15:09:18 +010090
Georgios Pinitas898a8062017-09-12 19:19:12 +010091REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
92 framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), data_types),
93 framework::dataset::make("Batches", { 4, 8 })));
SiCong Licc65bbe2017-08-18 11:58:21 +010094
Georgios Pinitas898a8062017-09-12 19:19:12 +010095REGISTER_FIXTURE_DATA_TEST_CASE(VGG16DirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
96 framework::dataset::combine(framework::dataset::combine(datasets::VGG16ConvolutionLayerDataset(), data_types),
Gian Marco33da05b2017-11-08 14:13:33 +000097 framework::dataset::make("Batches", { 1, 2 })));
SiCong Li1e5c1572017-07-27 17:58:52 +010098
Georgios Pinitas898a8062017-09-12 19:19:12 +010099REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2DirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
100 framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ConvolutionLayerDataset(), data_types),
101 framework::dataset::make("Batches", { 1, 4, 8 })));
SiCong Licc65bbe2017-08-18 11:58:21 +0100102
SiCong Li1e5c1572017-07-27 17:58:52 +0100103TEST_SUITE_END()
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100104TEST_SUITE_END()
Michalis Spyrou724079d2017-12-15 11:37:37 +0000105} // namespace benchmark
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100106} // namespace test
107} // namespace arm_compute