blob: f94ef6be194b63a38029d0d15ab4b5dfcede3fab [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"
Alex Gilday7da29b62018-03-23 14:16:00 +000030#include "tests/benchmark/fixtures/DirectConvolutionLayerFixture.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010031#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{
Vidhya Sudhan Loganathan7485d5a2018-07-04 09:34:00 +010050// Special data types for networks that need 5x5 direct convolution
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
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000058using NEDirectConvolutionLayerFixture = DirectConvolutionLayerFixture<Tensor, NEDirectConvolutionLayer, Accessor>;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010059
60TEST_SUITE(NEON)
61
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000062REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetDirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::ALL,
63 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::AlexNetDirectConvolutionLayerDataset(),
64 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
65 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010066 framework::dataset::make("Batches", 1)));
steniu01a629da12017-07-28 14:40:58 +010067
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000068REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1DirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::ALL,
69 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1DirectConvolutionLayerDataset(),
70 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
71 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010072 framework::dataset::make("Batches", 1)));
steniu01a629da12017-07-28 14:40:58 +010073
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000074REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4DirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::ALL,
75 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4DirectConvolutionLayerDataset(),
76 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
77 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010078 framework::dataset::make("Batches", 1)));
SiCong Lif583fb72017-08-15 15:09:18 +010079
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000080REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetDirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::ALL,
81 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(),
82 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
83 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010084 framework::dataset::make("Batches", 1)));
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010085
SiCong Li1e5c1572017-07-27 17:58:52 +010086TEST_SUITE(NIGHTLY)
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000087REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetDirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
88 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::AlexNetDirectConvolutionLayerDataset(),
89 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
90 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010091 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +010092
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000093REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1DirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
94 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1DirectConvolutionLayerDataset(),
95 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
96 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +010097 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +010098
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000099REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4DirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
100 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4DirectConvolutionLayerDataset(),
101 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
102 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +0100103 framework::dataset::make("Batches", { 4, 8 })));
SiCong Lif583fb72017-08-15 15:09:18 +0100104
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000105REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetDirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
106 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(),
107 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
108 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +0100109 framework::dataset::make("Batches", { 4, 8 })));
SiCong Licc65bbe2017-08-18 11:58:21 +0100110
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000111REGISTER_FIXTURE_DATA_TEST_CASE(VGG16DirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
112 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::VGG16ConvolutionLayerDataset(),
113 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
114 data_types),
Gian Marco33da05b2017-11-08 14:13:33 +0000115 framework::dataset::make("Batches", { 1, 2 })));
SiCong Li1e5c1572017-07-27 17:58:52 +0100116
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000117REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2DirectConvolutionLayer, NEDirectConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
118 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ConvolutionLayerDataset(),
119 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
120 data_types),
Georgios Pinitas898a8062017-09-12 19:19:12 +0100121 framework::dataset::make("Batches", { 1, 4, 8 })));
SiCong Licc65bbe2017-08-18 11:58:21 +0100122
SiCong Li1e5c1572017-07-27 17:58:52 +0100123TEST_SUITE_END()
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100124TEST_SUITE_END()
Michalis Spyrou724079d2017-12-15 11:37:37 +0000125} // namespace benchmark
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100126} // namespace test
127} // namespace arm_compute