From 1e5c1575fd7d86344b96988c86b82b66584460c8 Mon Sep 17 00:00:00 2001 From: SiCong Li Date: Thu, 27 Jul 2017 17:58:52 +0100 Subject: COMPMID-450 Add YOLOV2 benchmark tests * Migrate BatchNormalizationLayer to new benchmark system. * Add YOLOV2 benchmark tests. * Fix F16 type issue in activation_layer cl kernel. * Separate precommit tests from nightly tests. Change-Id: I3f206e3f7469be6749d630ede8dcc9fb399de8b0 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/81582 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- src/core/CL/cl_kernels/activation_layer.cl | 2 +- tests/benchmark_new/CL/ActivationLayer.cpp | 59 ++++++- tests/benchmark_new/CL/BatchNormalizationLayer.cpp | 62 +++++++ tests/benchmark_new/CL/ConvolutionLayer.cpp | 53 +++++- tests/benchmark_new/CL/DirectConvolutionLayer.cpp | 39 ++++- tests/benchmark_new/CL/FullyConnectedLayer.cpp | 33 +++- tests/benchmark_new/CL/NormalizationLayer.cpp | 21 ++- tests/benchmark_new/CL/PoolingLayer.cpp | 53 +++++- tests/benchmark_new/CL/SYSTEM/AlexNet.cpp | 2 +- tests/benchmark_new/NEON/ActivationLayer.cpp | 55 ++++-- .../benchmark_new/NEON/BatchNormalizationLayer.cpp | 65 +++++++ tests/benchmark_new/NEON/ConvolutionLayer.cpp | 34 +++- .../benchmark_new/NEON/DirectConvolutionLayer.cpp | 28 ++- tests/benchmark_new/NEON/FullyConnectedLayer.cpp | 37 +++- tests/benchmark_new/NEON/NormalizationLayer.cpp | 23 ++- tests/benchmark_new/NEON/PoolingLayer.cpp | 36 ++-- tests/datasets_new/ActivationLayerDataset.h | 193 --------------------- tests/datasets_new/AlexNetActivationLayerDataset.h | 61 +++++++ .../datasets_new/BatchNormalizationLayerDataset.h | 116 +++++++++++++ .../datasets_new/GoogLeNetActivationLayerDataset.h | 123 +++++++++++++ tests/datasets_new/LeNet5ActivationLayerDataset.h | 58 +++++++ .../SqueezeNetActivationLayerDataset.h | 77 ++++++++ tests/datasets_new/YOLOV2ActivationLayerDataset.h | 109 ++++++++++++ .../YOLOV2BatchNormalizationLayerDataset.h | 70 ++++++++ tests/datasets_new/YOLOV2ConvolutionLayerDataset.h | 76 ++++++++ tests/datasets_new/YOLOV2PoolingLayerDataset.h | 60 +++++++ .../fixtures_new/BatchNormalizationLayerFixture.h | 102 +++++++++++ 27 files changed, 1359 insertions(+), 288 deletions(-) create mode 100644 tests/benchmark_new/CL/BatchNormalizationLayer.cpp create mode 100644 tests/benchmark_new/NEON/BatchNormalizationLayer.cpp delete mode 100644 tests/datasets_new/ActivationLayerDataset.h create mode 100644 tests/datasets_new/AlexNetActivationLayerDataset.h create mode 100644 tests/datasets_new/BatchNormalizationLayerDataset.h create mode 100644 tests/datasets_new/GoogLeNetActivationLayerDataset.h create mode 100644 tests/datasets_new/LeNet5ActivationLayerDataset.h create mode 100644 tests/datasets_new/SqueezeNetActivationLayerDataset.h create mode 100644 tests/datasets_new/YOLOV2ActivationLayerDataset.h create mode 100644 tests/datasets_new/YOLOV2BatchNormalizationLayerDataset.h create mode 100644 tests/datasets_new/YOLOV2ConvolutionLayerDataset.h create mode 100644 tests/datasets_new/YOLOV2PoolingLayerDataset.h create mode 100644 tests/fixtures_new/BatchNormalizationLayerFixture.h diff --git a/src/core/CL/cl_kernels/activation_layer.cl b/src/core/CL/cl_kernels/activation_layer.cl index a1e7002c8b..7527b1ce37 100644 --- a/src/core/CL/cl_kernels/activation_layer.cl +++ b/src/core/CL/cl_kernels/activation_layer.cl @@ -42,7 +42,7 @@ #else /* FIXED_POINT_POSITION */ -#define CONST_ONE (1.f) +#define CONST_ONE 1.f #define ABS_OP(a) fabs((a)) #define ADD_OP(a, b) ((a) + (b)) #define SUB_OP(a, b) ((a) - (b)) diff --git a/tests/benchmark_new/CL/ActivationLayer.cpp b/tests/benchmark_new/CL/ActivationLayer.cpp index bf7b36a9e1..bb0bf3ea2a 100644 --- a/tests/benchmark_new/CL/ActivationLayer.cpp +++ b/tests/benchmark_new/CL/ActivationLayer.cpp @@ -30,37 +30,78 @@ #include "framework/datasets/Datasets.h" #include "tests/CL/CLAccessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/ActivationLayerDataset.h" +#include "tests/datasets_new/AlexNetActivationLayerDataset.h" +#include "tests/datasets_new/GoogLeNetActivationLayerDataset.h" +#include "tests/datasets_new/LeNet5ActivationLayerDataset.h" +#include "tests/datasets_new/SqueezeNetActivationLayerDataset.h" +#include "tests/datasets_new/YOLOV2ActivationLayerDataset.h" #include "tests/fixtures_new/ActivationLayerFixture.h" namespace arm_compute { namespace test { +namespace +{ +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16 }); +} // namespace + using CLActivationLayerFixture = ActivationLayerFixture; TEST_SUITE(CL) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetActivationLayer, CLActivationLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetActivationLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ActivationLayer, CLActivationLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ActivationLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetActivationLayer, CLActivationLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetActivationLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetActivationLayer, CLActivationLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetActivationLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2ActivationLayer, CLActivationLayerFixture, framework::DatasetMode::ALL, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ActivationLayerDataset(), + data_types), + framework::dataset::make("Batches", 1))); + +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetActivationLayer, CLActivationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetActivationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ActivationLayer, CLActivationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ActivationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetActivationLayer, CLActivationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetActivationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetActivationLayer, CLActivationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetActivationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2ActivationLayer, CLActivationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ActivationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/CL/BatchNormalizationLayer.cpp b/tests/benchmark_new/CL/BatchNormalizationLayer.cpp new file mode 100644 index 0000000000..d83d5deaf2 --- /dev/null +++ b/tests/benchmark_new/CL/BatchNormalizationLayer.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITCLSS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONCLCTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/runtime/CL/CLTensor.h" +#include "arm_compute/runtime/CL/CLTensorAllocator.h" +#include "arm_compute/runtime/CL/functions/CLBatchNormalizationLayer.h" +#include "framework/Macros.h" +#include "framework/datasets/Datasets.h" +#include "tests/CL/CLAccessor.h" +#include "tests/TypePrinter.h" +#include "tests/datasets_new/YOLOV2BatchNormalizationLayerDataset.h" +#include "tests/fixtures_new/BatchNormalizationLayerFixture.h" + +namespace arm_compute +{ +namespace test +{ +namespace +{ +const auto data_types = framework::dataset::make("DataType", { DataType::F32, DataType::QS8, DataType::QS16 }); +} // namespace + +using CLBatchNormalizationLayerFixture = BatchNormalizationLayerFixture; + +TEST_SUITE(CL) + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2BatchNormalizationLayer, CLBatchNormalizationLayerFixture, framework::DatasetMode::ALL, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2BatchNormalizationLayerDataset(), + data_types), + framework::dataset::make("Batches", 1))); + +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2BatchNormalizationLayer, CLBatchNormalizationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2BatchNormalizationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); +TEST_SUITE_END() +TEST_SUITE_END() +} // namespace test +} // namespace arm_compute diff --git a/tests/benchmark_new/CL/ConvolutionLayer.cpp b/tests/benchmark_new/CL/ConvolutionLayer.cpp index df98538083..25c0048a0f 100644 --- a/tests/benchmark_new/CL/ConvolutionLayer.cpp +++ b/tests/benchmark_new/CL/ConvolutionLayer.cpp @@ -34,33 +34,68 @@ #include "tests/datasets_new/GoogLeNetConvolutionLayerDataset.h" #include "tests/datasets_new/LeNet5ConvolutionLayerDataset.h" #include "tests/datasets_new/SqueezeNetConvolutionLayerDataset.h" +#include "tests/datasets_new/YOLOV2ConvolutionLayerDataset.h" #include "tests/fixtures_new/ConvolutionLayerFixture.h" namespace arm_compute { namespace test { -const auto data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::F16, DataType::F32 }); +namespace +{ +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16 }); +} // namespace + using CLConvolutionLayerFixture = ConvolutionLayerFixture; TEST_SUITE(CL) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", { 1, 4 }))); +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2ConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", { 1, 4, 8 }))); +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/CL/DirectConvolutionLayer.cpp b/tests/benchmark_new/CL/DirectConvolutionLayer.cpp index 5a4536ceef..82e5ef19ad 100644 --- a/tests/benchmark_new/CL/DirectConvolutionLayer.cpp +++ b/tests/benchmark_new/CL/DirectConvolutionLayer.cpp @@ -33,31 +33,58 @@ #include "tests/datasets_new/AlexNetConvolutionLayerDataset.h" #include "tests/datasets_new/GoogLeNetConvolutionLayerDataset.h" #include "tests/datasets_new/SqueezeNetConvolutionLayerDataset.h" +#include "tests/datasets_new/YOLOV2ConvolutionLayerDataset.h" #include "tests/fixtures_new/ConvolutionLayerFixture.h" namespace arm_compute { namespace test { +namespace +{ +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 }); +} // namespace + using CLConvolutionLayerFixture = ConvolutionLayerFixture; TEST_SUITE(CL) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetDirectConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetDirectConvolutionLayerDataset(), - framework::dataset::make("DataType", { DataType::F32 })), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetDirectConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetDirectConvolutionLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetDirectConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); + +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetDirectConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetDirectConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetDirectConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetDirectConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetDirectConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2DirectConvolutionLayer, CLConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ConvolutionLayerDataset(), + data_types), + framework::dataset::make("Batches", { 1, 4, 8 }))); +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/CL/FullyConnectedLayer.cpp b/tests/benchmark_new/CL/FullyConnectedLayer.cpp index a71c876ad6..e3404a0044 100644 --- a/tests/benchmark_new/CL/FullyConnectedLayer.cpp +++ b/tests/benchmark_new/CL/FullyConnectedLayer.cpp @@ -39,25 +39,46 @@ namespace arm_compute { namespace test { +namespace +{ +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16 }); +} // namespace + using CLFullyConnectedLayerFixture = FullyConnectedLayerFixture; TEST_SUITE(CL) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetFullyConnectedLayer, CLFullyConnectedLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetFullyConnectedLayerDataset(), - framework::dataset::make("DataType", { DataType::F32 })), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5FullyConnectedLayer, CLFullyConnectedLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::LeNet5FullyConnectedLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetFullyConnectedLayer, CLFullyConnectedLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetFullyConnectedLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); + +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetFullyConnectedLayer, CLFullyConnectedLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetFullyConnectedLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); +REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5FullyConnectedLayer, CLFullyConnectedLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5FullyConnectedLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetFullyConnectedLayer, CLFullyConnectedLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetFullyConnectedLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/CL/NormalizationLayer.cpp b/tests/benchmark_new/CL/NormalizationLayer.cpp index 7e2380ccc8..d5ae353512 100644 --- a/tests/benchmark_new/CL/NormalizationLayer.cpp +++ b/tests/benchmark_new/CL/NormalizationLayer.cpp @@ -40,7 +40,7 @@ namespace test { namespace { -const auto normalization_layer_data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F16, DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F16, DataType::F32 }); } // namespace using CLNormalizationLayerFixture = NormalizationLayerFixture; @@ -49,14 +49,25 @@ TEST_SUITE(CL) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetNormalizationLayer, CLNormalizationLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetNormalizationLayerDataset(), - normalization_layer_data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetNormalizationLayer, CLNormalizationLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetNormalizationLayerDataset(), - normalization_layer_data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetNormalizationLayer, CLNormalizationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetNormalizationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetNormalizationLayer, CLNormalizationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetNormalizationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/CL/PoolingLayer.cpp b/tests/benchmark_new/CL/PoolingLayer.cpp index de2299286b..4bbaa2aee2 100644 --- a/tests/benchmark_new/CL/PoolingLayer.cpp +++ b/tests/benchmark_new/CL/PoolingLayer.cpp @@ -34,36 +34,73 @@ #include "tests/datasets_new/GoogLeNetPoolingLayerDataset.h" #include "tests/datasets_new/LeNet5PoolingLayerDataset.h" #include "tests/datasets_new/SqueezeNetPoolingLayerDataset.h" +#include "tests/datasets_new/YOLOV2PoolingLayerDataset.h" #include "tests/fixtures_new/PoolingLayerFixture.h" namespace arm_compute { namespace test { +namespace +{ +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 }); +} // namespace + using CLPoolingLayerFixture = PoolingLayerFixture; TEST_SUITE(CL) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetPoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetPoolingLayerDataset(), - framework::dataset::make("DataType", { DataType::F32 })), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5PoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::LeNet5PoolingLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetPoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetPoolingLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetPoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetPoolingLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2PoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::ALL, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2PoolingLayerDataset(), + data_types), + framework::dataset::make("Batches", 1))); + +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetPoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetPoolingLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5PoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5PoolingLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetPoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetPoolingLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetPoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetPoolingLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2PoolingLayer, CLPoolingLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2PoolingLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/CL/SYSTEM/AlexNet.cpp b/tests/benchmark_new/CL/SYSTEM/AlexNet.cpp index 271ed9904e..4e5e729501 100644 --- a/tests/benchmark_new/CL/SYSTEM/AlexNet.cpp +++ b/tests/benchmark_new/CL/SYSTEM/AlexNet.cpp @@ -59,7 +59,7 @@ TEST_SUITE(CL) TEST_SUITE(SYSTEM_TEST) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNet, CLAlexNetFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::make("DataType", DataType::F32), + framework::dataset::combine(framework::dataset::make("DataType", { DataType::F16, DataType::F32 }), framework::dataset::make("Batches", { 1, 4, 8 }))); TEST_SUITE_END() diff --git a/tests/benchmark_new/NEON/ActivationLayer.cpp b/tests/benchmark_new/NEON/ActivationLayer.cpp index beb98b487a..065d15dcec 100644 --- a/tests/benchmark_new/NEON/ActivationLayer.cpp +++ b/tests/benchmark_new/NEON/ActivationLayer.cpp @@ -30,7 +30,11 @@ #include "framework/datasets/Datasets.h" #include "tests/NEON/Accessor.h" #include "tests/TypePrinter.h" -#include "tests/datasets_new/ActivationLayerDataset.h" +#include "tests/datasets_new/AlexNetActivationLayerDataset.h" +#include "tests/datasets_new/GoogLeNetActivationLayerDataset.h" +#include "tests/datasets_new/LeNet5ActivationLayerDataset.h" +#include "tests/datasets_new/SqueezeNetActivationLayerDataset.h" +#include "tests/datasets_new/YOLOV2ActivationLayerDataset.h" #include "tests/fixtures_new/ActivationLayerFixture.h" namespace arm_compute @@ -40,13 +44,9 @@ namespace test namespace { #ifdef ARM_COMPUTE_ENABLE_FP16 -const auto alexnet_data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::F16, DataType::F32 }); -const auto lenet_data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 }); -const auto squeezenet_data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16 }); #else /* ARM_COMPUTE_ENABLE_FP16 */ -const auto alexnet_data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::F32 }); -const auto lenet_data_types = framework::dataset::make("DataType", { DataType::F32 }); -const auto squeezenet_data_types = framework::dataset::make("DataType", { DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::F32, DataType::QS8, DataType::QS16 }); #endif /* ARM_COMPUTE_ENABLE_FP16 */ } // namespace @@ -55,21 +55,46 @@ using NEActivationLayerFixture = ActivationLayerFixture; + +TEST_SUITE(NEON) + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2BatchNormalizationLayer, NEBatchNormalizationLayerFixture, framework::DatasetMode::ALL, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2BatchNormalizationLayerDataset(), data_types), + framework::dataset::make("Batches", 1))); + +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2BatchNormalizationLayer, NEBatchNormalizationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2BatchNormalizationLayerDataset(), data_types), + framework::dataset::make("Batches", { 4, 8 }))); +TEST_SUITE_END() +TEST_SUITE_END() +} // namespace test +} // namespace arm_compute diff --git a/tests/benchmark_new/NEON/ConvolutionLayer.cpp b/tests/benchmark_new/NEON/ConvolutionLayer.cpp index c7ffc23729..a26effb7ca 100644 --- a/tests/benchmark_new/NEON/ConvolutionLayer.cpp +++ b/tests/benchmark_new/NEON/ConvolutionLayer.cpp @@ -34,6 +34,7 @@ #include "tests/datasets_new/GoogLeNetConvolutionLayerDataset.h" #include "tests/datasets_new/LeNet5ConvolutionLayerDataset.h" #include "tests/datasets_new/SqueezeNetConvolutionLayerDataset.h" +#include "tests/datasets_new/YOLOV2ConvolutionLayerDataset.h" #include "tests/fixtures_new/ConvolutionLayerFixture.h" namespace arm_compute @@ -43,9 +44,9 @@ namespace test namespace { #ifdef ARM_COMPUTE_ENABLE_FP16 -const auto data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::F16, DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8, DataType::QS16 }); #else /* ARM_COMPUTE_ENABLE_FP16 */ -const auto data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::F32, DataType::QS8, DataType::QS16 }); #endif /* ARM_COMPUTE_ENABLE_FP16 */ } // namespace @@ -55,20 +56,41 @@ TEST_SUITE(NEON) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::make("Batches", { 1, 4 }))); + +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(), data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(), data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetConvolutionLayerDataset(), data_types), + framework::dataset::make("Batches", 8))); +REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2ConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ConvolutionLayerDataset(), data_types), + framework::dataset::make("Batches", { 1, 4, 8 }))); +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/NEON/DirectConvolutionLayer.cpp b/tests/benchmark_new/NEON/DirectConvolutionLayer.cpp index 892976d316..e6fddba034 100644 --- a/tests/benchmark_new/NEON/DirectConvolutionLayer.cpp +++ b/tests/benchmark_new/NEON/DirectConvolutionLayer.cpp @@ -34,6 +34,7 @@ #include "tests/datasets_new/DirectConvolutionLayerDataset.h" #include "tests/datasets_new/GoogLeNetConvolutionLayerDataset.h" #include "tests/datasets_new/SqueezeNetConvolutionLayerDataset.h" +#include "tests/datasets_new/YOLOV2ConvolutionLayerDataset.h" #include "tests/fixtures_new/ConvolutionLayerFixture.h" namespace arm_compute @@ -53,22 +54,35 @@ using NEConvolutionLayerFixture = ConvolutionLayerFixture; TEST_SUITE(NEON) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetFullyConnectedLayer, NEFullyConnectedLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetFullyConnectedLayerDataset(), - framework::dataset::make("DataType", { DataType::F32, DataType::QS8 })), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5FullyConnectedLayer, NEFullyConnectedLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::LeNet5FullyConnectedLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetFullyConnectedLayer, NEFullyConnectedLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetFullyConnectedLayerDataset(), - framework::dataset::make("DataType", DataType::F32)), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", { 1, 4 }))); + +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetFullyConnectedLayer, NEFullyConnectedLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetFullyConnectedLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); +REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5FullyConnectedLayer, NEFullyConnectedLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5FullyConnectedLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetFullyConnectedLayer, NEFullyConnectedLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetFullyConnectedLayerDataset(), + data_types), + framework::dataset::make("Batches", 8))); +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/NEON/NormalizationLayer.cpp b/tests/benchmark_new/NEON/NormalizationLayer.cpp index de7183d2ec..5496e183ce 100644 --- a/tests/benchmark_new/NEON/NormalizationLayer.cpp +++ b/tests/benchmark_new/NEON/NormalizationLayer.cpp @@ -41,9 +41,9 @@ namespace test namespace { #ifdef ARM_COMPUTE_ENABLE_FP16 -const auto normalization_layer_data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F16, DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F16, DataType::F32 }); #else /* ARM_COMPUTE_ENABLE_FP16 */ -const auto normalization_layer_data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F32 }); #endif /* ARM_COMPUTE_ENABLE_FP16 */ } // namespace using NENormalizationLayerFixture = NormalizationLayerFixture; @@ -52,14 +52,25 @@ TEST_SUITE(NEON) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetNormalizationLayer, NENormalizationLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetNormalizationLayerDataset(), - normalization_layer_data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetNormalizationLayer, NENormalizationLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetNormalizationLayerDataset(), - normalization_layer_data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + data_types), + framework::dataset::make("Batches", 1))); +TEST_SUITE(NIGHTLY) +REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetNormalizationLayer, NENormalizationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetNormalizationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); + +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetNormalizationLayer, NENormalizationLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetNormalizationLayerDataset(), + data_types), + framework::dataset::make("Batches", { 4, 8 }))); +TEST_SUITE_END() TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark_new/NEON/PoolingLayer.cpp b/tests/benchmark_new/NEON/PoolingLayer.cpp index 099102441a..af2a925a7e 100644 --- a/tests/benchmark_new/NEON/PoolingLayer.cpp +++ b/tests/benchmark_new/NEON/PoolingLayer.cpp @@ -34,6 +34,7 @@ #include "tests/datasets_new/GoogLeNetPoolingLayerDataset.h" #include "tests/datasets_new/LeNet5PoolingLayerDataset.h" #include "tests/datasets_new/SqueezeNetPoolingLayerDataset.h" +#include "tests/datasets_new/YOLOV2PoolingLayerDataset.h" #include "tests/fixtures_new/PoolingLayerFixture.h" namespace arm_compute @@ -43,13 +44,9 @@ namespace test namespace { #ifdef ARM_COMPUTE_ENABLE_FP16 -const auto alexnet_data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::F16, DataType::F32 }); -const auto lenet_data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 }); -const auto squeezenet_data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8 }); #else /* ARM_COMPUTE_ENABLE_FP16 */ -const auto alexnet_data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::F32 }); -const auto lenet_data_types = framework::dataset::make("DataType", { DataType::F32 }); -const auto squeezenet_data_types = framework::dataset::make("DataType", { DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::F32, DataType::QS8 }); #endif /* ARM_COMPUTE_ENABLE_FP16 */ } // namespace @@ -58,17 +55,36 @@ using NEPoolingLayerFixture = PoolingLayerFixture, framework::dataset::SingletonDataset> -{ -public: - AlexNetActivationLayerDataset() - : CartesianProductDataset - { - framework::dataset::make("Shape", { - TensorShape(55U, 55U, 96U), TensorShape(27U, 27U, 256U), - TensorShape(13U, 13U, 384U), TensorShape(13U, 13U, 256U), - TensorShape(4096U) }), - framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) - } - { - } - AlexNetActivationLayerDataset(AlexNetActivationLayerDataset &&) = default; - ~AlexNetActivationLayerDataset() = default; -}; - -class LeNet5ActivationLayerDataset final : public - framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> -{ -public: - LeNet5ActivationLayerDataset() - : CartesianProductDataset - { - framework::dataset::make("Shape", TensorShape(500U)), - framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) - } - { - } - LeNet5ActivationLayerDataset(LeNet5ActivationLayerDataset &&) = default; - ~LeNet5ActivationLayerDataset() = default; -}; - -class GoogLeNetActivationLayerDataset final : public - framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> -{ -public: - GoogLeNetActivationLayerDataset() - : CartesianProductDataset - { - framework::dataset::make("Shape", { // conv1/relu_7x7 - TensorShape(112U, 112U, 64U), - // conv2/relu_3x3_reduce - TensorShape(56U, 56U, 64U), - // conv2/relu_3x3 - TensorShape(56U, 56U, 192U), - // inception_3a/relu_1x1, inception_3b/relu_pool_proj - TensorShape(28U, 28U, 64U), - // inception_3a/relu_3x3_reduce, inception_3b/relu_5x5 - TensorShape(28U, 28U, 96U), - // inception_3a/relu_3x3, inception_3b/relu_1x1, inception_3b/relu_3x3_reduce - TensorShape(28U, 28U, 128U), - // inception_3a/relu_5x5_reduce - TensorShape(28U, 28U, 16U), - // inception_3a/relu_5x5, inception_3a/relu_pool_proj, inception_3b/relu_5x5_reduce - TensorShape(28U, 28U, 32U), - // inception_3b/relu_3x3 - TensorShape(28U, 28U, 192U), - // inception_4a/relu_1x1 - TensorShape(14U, 14U, 192U), - // inception_4a/relu_3x3_reduce - TensorShape(14U, 14U, 96U), - // inception_4a/relu_3x3 - TensorShape(14U, 14U, 208U), - // inception_4a/relu_5x5_reduce - TensorShape(14U, 14U, 16U), - // inception_4a/relu_5x5 - TensorShape(14U, 14U, 48U), - // inception_4a/relu_pool_proj, inception_4b/relu_5x5, inception_4b/relu_pool_proj, inception_4c/relu_5x5, inception_4c/relu_pool_proj, inception_4d/relu_5x5, inception_4d/relu_pool_proj - TensorShape(14U, 14U, 64U), - // inception_4b/relu_1x1, inception_4e/relu_3x3_reduce - TensorShape(14U, 14U, 160U), - // inception_4b/relu_3x3_reduce, inception_4d/relu_1x1 - TensorShape(14U, 14U, 112U), - // inception_4b/relu_3x3 - TensorShape(14U, 14U, 224U), - // inception_4b/relu_5x5_reduce, inception_4c/relu_5x5_reduce - TensorShape(14U, 14U, 24U), - // inception_4c/relu_1x1, inception_4c/relu_3x3_reduce, inception_4e/relu_5x5, inception_4e/relu_pool_proj - TensorShape(14U, 14U, 128U), - // inception_4c/relu_3x3, inception_4e/relu_1x1 - TensorShape(14U, 14U, 256U), - // inception_4d/relu_3x3_reduce - TensorShape(14U, 14U, 144U), - // inception_4d/relu_3x3 - TensorShape(14U, 14U, 288U), - // inception_4d/relu_5x5_reduce, inception_4e/relu_5x5_reduce - TensorShape(14U, 14U, 32U), - // inception_4e/relu_3x3 - TensorShape(14U, 14U, 320U), - // inception_5a/relu_1x1 - TensorShape(7U, 7U, 256U), - // inception_5a/relu_3x3_reduce - TensorShape(7U, 7U, 160U), - // inception_5a/relu_3x3 - TensorShape(7U, 7U, 320U), - // inception_5a/relu_5x5_reduce - TensorShape(7U, 7U, 32U), - // inception_5a/relu_5x5, inception_5a/relu_pool_proj, inception_5b/relu_5x5, inception_5b/relu_pool_proj - TensorShape(7U, 7U, 128U), - // inception_5b/relu_1x1, inception_5b/relu_3x3 - TensorShape(7U, 7U, 384U), - // inception_5b/relu_3x3_reduce - TensorShape(7U, 7U, 192U), - // inception_5b/relu_5x5_reduce - TensorShape(7U, 7U, 48U) }), - framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) - } - { - } - GoogLeNetActivationLayerDataset(GoogLeNetActivationLayerDataset &&) = default; - ~GoogLeNetActivationLayerDataset() = default; -}; - -class SqueezeNetActivationLayerDataset final : public - framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> -{ -public: - SqueezeNetActivationLayerDataset() - : CartesianProductDataset - { - framework::dataset::make("Shape", { // relu_conv1 - TensorShape(111U, 111U, 64U), - // fire2/relu_squeeze1x1, fire3/relu_squeeze1x1 - TensorShape(55U, 55U, 16U), - // fire2/relu_expand1x1, fire2/relu_expand3x3, fire3/relu_expand1x1, fire3/relu_expand3x3 - TensorShape(55U, 55U, 64U), - // fire4/relu_squeeze1x1, fire5/relu_squeeze1x1 - TensorShape(27U, 27U, 32U), - // fire4/relu_expand1x1, fire4/relu_expand3x3, fire5/relu_expand1x1, fire5/relu_expand3x3 - TensorShape(27U, 27U, 128U), - // fire6/relu_squeeze1x1, fire7/relu_squeeze1x1 - TensorShape(13U, 13U, 48U), - // fire6/relu_expand1x1, fire6/relu_expand3x3, fire7/relu_expand1x1, fire7/relu_expand3x3 - TensorShape(13U, 13U, 192U), - // fire8/relu_squeeze1x1, fire9/relu_squeeze1x1 - TensorShape(13U, 13U, 64U), - // fire8/relu_expand1x1, fire8/relu_expand3x3, fire9/relu_expand1x1, fire9/relu_expand3x3 - TensorShape(13U, 13U, 256U), - // relu_conv10 - TensorShape(13U, 13U, 1000U) }), - framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) - } - { - } - SqueezeNetActivationLayerDataset(SqueezeNetActivationLayerDataset &&) = default; - ~SqueezeNetActivationLayerDataset() = default; -}; -} // namespace datasets -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_ACTIVATION_LAYER_DATASET */ diff --git a/tests/datasets_new/AlexNetActivationLayerDataset.h b/tests/datasets_new/AlexNetActivationLayerDataset.h new file mode 100644 index 0000000000..27e9956647 --- /dev/null +++ b/tests/datasets_new/AlexNetActivationLayerDataset.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_ALEXNET_ACTIVATION_LAYER_DATASET +#define ARM_COMPUTE_TEST_ALEXNET_ACTIVATION_LAYER_DATASET + +#include "framework/datasets/Datasets.h" + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class AlexNetActivationLayerDataset final : public + framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> +{ +public: + AlexNetActivationLayerDataset() + : CartesianProductDataset + { + framework::dataset::make("Shape", { + TensorShape(55U, 55U, 96U), TensorShape(27U, 27U, 256U), + TensorShape(13U, 13U, 384U), TensorShape(13U, 13U, 256U), + TensorShape(4096U) }), + framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) + } + { + } + AlexNetActivationLayerDataset(AlexNetActivationLayerDataset &&) = default; + ~AlexNetActivationLayerDataset() = default; +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_ALEXNET_ACTIVATION_LAYER_DATASET */ diff --git a/tests/datasets_new/BatchNormalizationLayerDataset.h b/tests/datasets_new/BatchNormalizationLayerDataset.h new file mode 100644 index 0000000000..25e65d931c --- /dev/null +++ b/tests/datasets_new/BatchNormalizationLayerDataset.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_BATCHNORMALIZATION_LAYER_DATASET +#define ARM_COMPUTE_TEST_BATCHNORMALIZATION_LAYER_DATASET + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class BatchNormalizationLayerDataset +{ +public: + using type = std::tuple; + + struct iterator + { + iterator(std::vector::const_iterator tensor_it, + std::vector::const_iterator param_it, + std::vector::const_iterator epsilon_it) + : _tensor_it{ std::move(tensor_it) }, + _param_it{ std::move(param_it) }, + _epsilon_it{ std::move(epsilon_it) } + { + } + + std::string description() const + { + std::stringstream description; + description << "In=" << *_tensor_it << ":"; + description << "Out=" << *_tensor_it << ":"; + description << "Mean=" << *_param_it << ":"; + description << "Variance=" << *_param_it << ":"; + description << "Beta=" << *_param_it << ":"; + description << "Gamma=" << *_param_it << ":"; + description << "Epsilon=" << *_epsilon_it; + return description.str(); + } + + BatchNormalizationLayerDataset::type operator*() const + { + return std::make_tuple(*_tensor_it, *_param_it, *_epsilon_it); + } + + iterator &operator++() + { + ++_tensor_it; + ++_param_it; + ++_epsilon_it; + + return *this; + } + + private: + std::vector::const_iterator _tensor_it; + std::vector::const_iterator _param_it; + std::vector::const_iterator _epsilon_it; + }; + + iterator begin() const + { + return iterator(_tensor_shapes.begin(), _param_shapes.begin(), _epsilons.begin()); + } + + int size() const + { + return std::min(_tensor_shapes.size(), std::min(_param_shapes.size(), _epsilons.size())); + } + + void add_config(TensorShape tensor, TensorShape param, float epsilon) + { + _tensor_shapes.emplace_back(std::move(tensor)); + _param_shapes.emplace_back(std::move(param)); + _epsilons.emplace_back(std::move(epsilon)); + } + +protected: + BatchNormalizationLayerDataset() = default; + BatchNormalizationLayerDataset(BatchNormalizationLayerDataset &&) = default; + +private: + std::vector _tensor_shapes{}; + std::vector _param_shapes{}; + std::vector _epsilons{}; +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_BATCHNORMALIZATION_LAYER_DATASET */ diff --git a/tests/datasets_new/GoogLeNetActivationLayerDataset.h b/tests/datasets_new/GoogLeNetActivationLayerDataset.h new file mode 100644 index 0000000000..935edbc4aa --- /dev/null +++ b/tests/datasets_new/GoogLeNetActivationLayerDataset.h @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_GOOGLENET_ACTIVATION_LAYER_DATASET +#define ARM_COMPUTE_TEST_GOOGLENET_ACTIVATION_LAYER_DATASET + +#include "framework/datasets/Datasets.h" + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class GoogLeNetActivationLayerDataset final : public + framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> +{ +public: + GoogLeNetActivationLayerDataset() + : CartesianProductDataset + { + framework::dataset::make("Shape", { // conv1/relu_7x7 + TensorShape(112U, 112U, 64U), + // conv2/relu_3x3_reduce + TensorShape(56U, 56U, 64U), + // conv2/relu_3x3 + TensorShape(56U, 56U, 192U), + // inception_3a/relu_1x1, inception_3b/relu_pool_proj + TensorShape(28U, 28U, 64U), + // inception_3a/relu_3x3_reduce, inception_3b/relu_5x5 + TensorShape(28U, 28U, 96U), + // inception_3a/relu_3x3, inception_3b/relu_1x1, inception_3b/relu_3x3_reduce + TensorShape(28U, 28U, 128U), + // inception_3a/relu_5x5_reduce + TensorShape(28U, 28U, 16U), + // inception_3a/relu_5x5, inception_3a/relu_pool_proj, inception_3b/relu_5x5_reduce + TensorShape(28U, 28U, 32U), + // inception_3b/relu_3x3 + TensorShape(28U, 28U, 192U), + // inception_4a/relu_1x1 + TensorShape(14U, 14U, 192U), + // inception_4a/relu_3x3_reduce + TensorShape(14U, 14U, 96U), + // inception_4a/relu_3x3 + TensorShape(14U, 14U, 208U), + // inception_4a/relu_5x5_reduce + TensorShape(14U, 14U, 16U), + // inception_4a/relu_5x5 + TensorShape(14U, 14U, 48U), + // inception_4a/relu_pool_proj, inception_4b/relu_5x5, inception_4b/relu_pool_proj, inception_4c/relu_5x5, inception_4c/relu_pool_proj, inception_4d/relu_5x5, inception_4d/relu_pool_proj + TensorShape(14U, 14U, 64U), + // inception_4b/relu_1x1, inception_4e/relu_3x3_reduce + TensorShape(14U, 14U, 160U), + // inception_4b/relu_3x3_reduce, inception_4d/relu_1x1 + TensorShape(14U, 14U, 112U), + // inception_4b/relu_3x3 + TensorShape(14U, 14U, 224U), + // inception_4b/relu_5x5_reduce, inception_4c/relu_5x5_reduce + TensorShape(14U, 14U, 24U), + // inception_4c/relu_1x1, inception_4c/relu_3x3_reduce, inception_4e/relu_5x5, inception_4e/relu_pool_proj + TensorShape(14U, 14U, 128U), + // inception_4c/relu_3x3, inception_4e/relu_1x1 + TensorShape(14U, 14U, 256U), + // inception_4d/relu_3x3_reduce + TensorShape(14U, 14U, 144U), + // inception_4d/relu_3x3 + TensorShape(14U, 14U, 288U), + // inception_4d/relu_5x5_reduce, inception_4e/relu_5x5_reduce + TensorShape(14U, 14U, 32U), + // inception_4e/relu_3x3 + TensorShape(14U, 14U, 320U), + // inception_5a/relu_1x1 + TensorShape(7U, 7U, 256U), + // inception_5a/relu_3x3_reduce + TensorShape(7U, 7U, 160U), + // inception_5a/relu_3x3 + TensorShape(7U, 7U, 320U), + // inception_5a/relu_5x5_reduce + TensorShape(7U, 7U, 32U), + // inception_5a/relu_5x5, inception_5a/relu_pool_proj, inception_5b/relu_5x5, inception_5b/relu_pool_proj + TensorShape(7U, 7U, 128U), + // inception_5b/relu_1x1, inception_5b/relu_3x3 + TensorShape(7U, 7U, 384U), + // inception_5b/relu_3x3_reduce + TensorShape(7U, 7U, 192U), + // inception_5b/relu_5x5_reduce + TensorShape(7U, 7U, 48U) }), + framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) + } + { + } + GoogLeNetActivationLayerDataset(GoogLeNetActivationLayerDataset &&) = default; + ~GoogLeNetActivationLayerDataset() = default; +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_GOOGLENET_ACTIVATION_LAYER_DATASET */ diff --git a/tests/datasets_new/LeNet5ActivationLayerDataset.h b/tests/datasets_new/LeNet5ActivationLayerDataset.h new file mode 100644 index 0000000000..5d2a36bfd3 --- /dev/null +++ b/tests/datasets_new/LeNet5ActivationLayerDataset.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_LENET5_ACTIVATION_LAYER_DATASET +#define ARM_COMPUTE_TEST_LENET5_ACTIVATION_LAYER_DATASET + +#include "framework/datasets/Datasets.h" + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class LeNet5ActivationLayerDataset final : public + framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> +{ +public: + LeNet5ActivationLayerDataset() + : CartesianProductDataset + { + framework::dataset::make("Shape", TensorShape(500U)), + framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) + } + { + } + LeNet5ActivationLayerDataset(LeNet5ActivationLayerDataset &&) = default; + ~LeNet5ActivationLayerDataset() = default; +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_LENET5_ACTIVATION_LAYER_DATASET */ diff --git a/tests/datasets_new/SqueezeNetActivationLayerDataset.h b/tests/datasets_new/SqueezeNetActivationLayerDataset.h new file mode 100644 index 0000000000..9cc9973f8f --- /dev/null +++ b/tests/datasets_new/SqueezeNetActivationLayerDataset.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_SQUEEZENET_ACTIVATION_LAYER_DATASET +#define ARM_COMPUTE_TEST_SQUEEZENET_ACTIVATION_LAYER_DATASET + +#include "framework/datasets/Datasets.h" + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class SqueezeNetActivationLayerDataset final : public + framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> +{ +public: + SqueezeNetActivationLayerDataset() + : CartesianProductDataset + { + framework::dataset::make("Shape", { // relu_conv1 + TensorShape(111U, 111U, 64U), + // fire2/relu_squeeze1x1, fire3/relu_squeeze1x1 + TensorShape(55U, 55U, 16U), + // fire2/relu_expand1x1, fire2/relu_expand3x3, fire3/relu_expand1x1, fire3/relu_expand3x3 + TensorShape(55U, 55U, 64U), + // fire4/relu_squeeze1x1, fire5/relu_squeeze1x1 + TensorShape(27U, 27U, 32U), + // fire4/relu_expand1x1, fire4/relu_expand3x3, fire5/relu_expand1x1, fire5/relu_expand3x3 + TensorShape(27U, 27U, 128U), + // fire6/relu_squeeze1x1, fire7/relu_squeeze1x1 + TensorShape(13U, 13U, 48U), + // fire6/relu_expand1x1, fire6/relu_expand3x3, fire7/relu_expand1x1, fire7/relu_expand3x3 + TensorShape(13U, 13U, 192U), + // fire8/relu_squeeze1x1, fire9/relu_squeeze1x1 + TensorShape(13U, 13U, 64U), + // fire8/relu_expand1x1, fire8/relu_expand3x3, fire9/relu_expand1x1, fire9/relu_expand3x3 + TensorShape(13U, 13U, 256U), + // relu_conv10 + TensorShape(13U, 13U, 1000U) }), + framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) + } + { + } + SqueezeNetActivationLayerDataset(SqueezeNetActivationLayerDataset &&) = default; + ~SqueezeNetActivationLayerDataset() = default; +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_SQUEEZENET_ACTIVATION_LAYER_DATASET */ diff --git a/tests/datasets_new/YOLOV2ActivationLayerDataset.h b/tests/datasets_new/YOLOV2ActivationLayerDataset.h new file mode 100644 index 0000000000..31327fa0d2 --- /dev/null +++ b/tests/datasets_new/YOLOV2ActivationLayerDataset.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_YOLOV2_ACTIVATION_LAYER_DATASET +#define ARM_COMPUTE_TEST_YOLOV2_ACTIVATION_LAYER_DATASET + +#include "framework/datasets/Datasets.h" + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class YOLOV2ActivationLayerRELUDataset final : public + framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> +{ +public: + YOLOV2ActivationLayerRELUDataset() + : CartesianProductDataset + { + framework::dataset::make("Shape", { // relu1 + TensorShape(416U, 416U, 32U), + // relu2 + TensorShape(208U, 208U, 64U), + // relu3, relu5 + TensorShape(104U, 104U, 128U), + // relu4 + TensorShape(104U, 104U, 64U), + // relu6, relu8 + TensorShape(52U, 52U, 256U), + // relu7 + TensorShape(52U, 52U, 128U), + // relu9, relu11, relu13 + TensorShape(26U, 26U, 512U), + // relu10, relu12 + TensorShape(26U, 26U, 256U), + // relu14, relu16, relu18, relu19, relu20, relu21 + TensorShape(13U, 13U, 1024U), + // relu15, relu17 + TensorShape(13U, 13U, 512U) }), + framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) + } + { + } + YOLOV2ActivationLayerRELUDataset(YOLOV2ActivationLayerRELUDataset &&) = default; + ~YOLOV2ActivationLayerRELUDataset() = default; +}; + +class YOLOV2ActivationLayerLINEARDataset final : public + framework::dataset::CartesianProductDataset, framework::dataset::SingletonDataset> +{ +public: + YOLOV2ActivationLayerLINEARDataset() + : CartesianProductDataset + { + framework::dataset::make("Shape", { // linear22 + TensorShape(15U, 15U, 425U) }), + framework::dataset::make("Info", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LINEAR)) + } + { + } + YOLOV2ActivationLayerLINEARDataset(YOLOV2ActivationLayerLINEARDataset &&) = default; + ~YOLOV2ActivationLayerLINEARDataset() = default; +}; + +class YOLOV2ActivationLayerDataset final : public framework::dataset::JoinDataset +{ +public: + YOLOV2ActivationLayerDataset() + : JoinDataset + { + YOLOV2ActivationLayerRELUDataset(), + YOLOV2ActivationLayerLINEARDataset() + } + { + } + YOLOV2ActivationLayerDataset(YOLOV2ActivationLayerDataset &&) = default; + ~YOLOV2ActivationLayerDataset() = default; +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_YOLOV2_ACTIVATION_LAYER_DATASET */ diff --git a/tests/datasets_new/YOLOV2BatchNormalizationLayerDataset.h b/tests/datasets_new/YOLOV2BatchNormalizationLayerDataset.h new file mode 100644 index 0000000000..8cb69db869 --- /dev/null +++ b/tests/datasets_new/YOLOV2BatchNormalizationLayerDataset.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_YOLOV2_BATCHNORMALIZATION_LAYER_DATASET +#define ARM_COMPUTE_TEST_YOLOV2_BATCHNORMALIZATION_LAYER_DATASET + +#include "tests/datasets_new/BatchNormalizationLayerDataset.h" + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class YOLOV2BatchNormalizationLayerDataset final : public BatchNormalizationLayerDataset +{ +public: + YOLOV2BatchNormalizationLayerDataset() + { + // conv1_bn + add_config(TensorShape(416U, 416U, 32U), TensorShape(32U), 0.00001f); + // conv2_bn + add_config(TensorShape(208U, 208U, 64U), TensorShape(64U), 0.00001f); + // conv3_bn, conv5_bn + add_config(TensorShape(104U, 104U, 128U), TensorShape(128U), 0.00001f); + // conv4_bn + add_config(TensorShape(104U, 104U, 64U), TensorShape(64U), 0.00001f); + // conv6_bn, conv8_bn + add_config(TensorShape(52U, 52U, 256U), TensorShape(256U), 0.00001f); + // conv7_bn + add_config(TensorShape(52U, 52U, 128U), TensorShape(128U), 0.00001f); + // conv9_bn, conv11_bn, conv13_bn + add_config(TensorShape(26U, 26U, 512U), TensorShape(512U), 0.00001f); + // conv10_bn, conv12_bn + add_config(TensorShape(26U, 26U, 256U), TensorShape(256U), 0.00001f); + // conv14_bn, conv16_bn, conv18_bn, conv19_bn, conv20_bn, conv21_bn + add_config(TensorShape(13U, 13U, 1024U), TensorShape(1024U), 0.00001f); + // conv15_bn, conv17_bn + add_config(TensorShape(13U, 13U, 512U), TensorShape(512U), 0.00001f); + } +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_YOLOV2_BATCHNORMALIZATION_LAYER_DATASET */ diff --git a/tests/datasets_new/YOLOV2ConvolutionLayerDataset.h b/tests/datasets_new/YOLOV2ConvolutionLayerDataset.h new file mode 100644 index 0000000000..ad3c38570e --- /dev/null +++ b/tests/datasets_new/YOLOV2ConvolutionLayerDataset.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_YOLOV2_CONVOLUTION_LAYER_DATASET +#define ARM_COMPUTE_TEST_YOLOV2_CONVOLUTION_LAYER_DATASET + +#include "tests/datasets_new/ConvolutionLayerDataset.h" + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class YOLOV2ConvolutionLayerDataset final : public ConvolutionLayerDataset +{ +public: + YOLOV2ConvolutionLayerDataset() + { + // conv1 + add_config(TensorShape(416U, 416U, 3U), TensorShape(3U, 3U, 3U, 32U), TensorShape(32U), TensorShape(416U, 416U, 32U), PadStrideInfo(1, 1, 1, 1)); + // conv2 + add_config(TensorShape(208U, 208U, 32U), TensorShape(3U, 3U, 32U, 64U), TensorShape(64U), TensorShape(208U, 208U, 64U), PadStrideInfo(1, 1, 1, 1)); + // conv3, conv5 + add_config(TensorShape(104U, 104U, 64U), TensorShape(3U, 3U, 64U, 128U), TensorShape(128U), TensorShape(104U, 104U, 128U), PadStrideInfo(1, 1, 1, 1)); + // conv4 + add_config(TensorShape(104U, 104U, 128U), TensorShape(1U, 1U, 128U, 64U), TensorShape(64U), TensorShape(104U, 104U, 64U), PadStrideInfo(1, 1, 0, 0)); + // conv6, conv8 + add_config(TensorShape(52U, 52U, 128U), TensorShape(3U, 3U, 128U, 256U), TensorShape(256U), TensorShape(52U, 52U, 256U), PadStrideInfo(1, 1, 1, 1)); + // conv7 + add_config(TensorShape(52U, 52U, 256U), TensorShape(1U, 1U, 256U, 128U), TensorShape(128U), TensorShape(52U, 52U, 128U), PadStrideInfo(1, 1, 0, 0)); + // conv9, conv11, conv13 + add_config(TensorShape(26U, 26U, 256U), TensorShape(3U, 3U, 256U, 512U), TensorShape(512U), TensorShape(26U, 26U, 512U), PadStrideInfo(1, 1, 1, 1)); + // conv10, conv12 + add_config(TensorShape(26U, 26U, 512U), TensorShape(1U, 1U, 512U, 256U), TensorShape(256U), TensorShape(26U, 26U, 256U), PadStrideInfo(1, 1, 0, 0)); + // conv14, conv16, conv18 + add_config(TensorShape(13U, 13U, 512U), TensorShape(3U, 3U, 512U, 1024U), TensorShape(1024U), TensorShape(13U, 13U, 1024U), PadStrideInfo(1, 1, 1, 1)); + // conv15, conv17 + add_config(TensorShape(13U, 13U, 1024U), TensorShape(1U, 1U, 1024U, 512U), TensorShape(512U), TensorShape(13U, 13U, 512U), PadStrideInfo(1, 1, 0, 0)); + // conv19, conv20 + add_config(TensorShape(13U, 13U, 1024U), TensorShape(3U, 3U, 1024U, 1024U), TensorShape(1024U), TensorShape(13U, 13U, 1024U), PadStrideInfo(1, 1, 1, 1)); + // conv21 + add_config(TensorShape(13U, 13U, 3072U), TensorShape(3U, 3U, 3072U, 1024U), TensorShape(1024U), TensorShape(13U, 13U, 1024U), PadStrideInfo(1, 1, 1, 1)); + // conv22 + add_config(TensorShape(13U, 13U, 1024U), TensorShape(1U, 1U, 1024U, 425U), TensorShape(425U), TensorShape(15U, 15U, 425U), PadStrideInfo(1, 1, 1, 1)); + } +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_YOLOV2_CONVOLUTION_LAYER_DATASET */ diff --git a/tests/datasets_new/YOLOV2PoolingLayerDataset.h b/tests/datasets_new/YOLOV2PoolingLayerDataset.h new file mode 100644 index 0000000000..273409dec6 --- /dev/null +++ b/tests/datasets_new/YOLOV2PoolingLayerDataset.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_YOLOV2_POOLING_LAYER_DATASET +#define ARM_COMPUTE_TEST_YOLOV2_POOLING_LAYER_DATASET + +#include "tests/datasets_new/PoolingLayerDataset.h" + +#include "tests/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +namespace arm_compute +{ +namespace test +{ +namespace datasets +{ +class YOLOV2PoolingLayerDataset final : public PoolingLayerDataset +{ +public: + YOLOV2PoolingLayerDataset() + { + // pool1 + add_config(TensorShape(416U, 416U, 32U), TensorShape(208U, 208U, 32U), PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))); + // pool2 + add_config(TensorShape(208U, 208U, 64U), TensorShape(104U, 104U, 64U), PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))); + // pool5 + add_config(TensorShape(104U, 104U, 128U), TensorShape(52U, 52U, 128U), PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))); + // pool8 + add_config(TensorShape(52U, 52U, 256U), TensorShape(26U, 26U, 256U), PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))); + // pool13 + add_config(TensorShape(26U, 26U, 512U), TensorShape(13U, 13U, 512U), PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))); + } +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_YOLOV2_POOLING_LAYER_DATASET */ diff --git a/tests/fixtures_new/BatchNormalizationLayerFixture.h b/tests/fixtures_new/BatchNormalizationLayerFixture.h new file mode 100644 index 0000000000..39c80e5405 --- /dev/null +++ b/tests/fixtures_new/BatchNormalizationLayerFixture.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2017 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_TEST_BATCHNORMALIZATIONLAYERFIXTURE +#define ARM_COMPUTE_TEST_BATCHNORMALIZATIONLAYERFIXTURE + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" +#include "framework/Fixture.h" +#include "tests/Globals.h" +#include "tests/Utils.h" + +namespace arm_compute +{ +namespace test +{ +/** Fixture that can be used for NEON and CL */ +template +class BatchNormalizationLayerFixture : public framework::Fixture +{ +public: + template + void setup(TensorShape tensor_shape, TensorShape param_shape, float epsilon, DataType data_type, int batches) + { + // Set batched in source and destination shapes + const unsigned int fixed_point_position = 4; + tensor_shape.set(tensor_shape.num_dimensions(), batches); + + // Create tensors + src = create_tensor(tensor_shape, data_type, 1, fixed_point_position); + dst = create_tensor(tensor_shape, data_type, 1, fixed_point_position); + mean = create_tensor(param_shape, data_type, 1, fixed_point_position); + variance = create_tensor(param_shape, data_type, 1, fixed_point_position); + beta = create_tensor(param_shape, data_type, 1, fixed_point_position); + gamma = create_tensor(param_shape, data_type, 1, fixed_point_position); + + // Create and configure function + batch_norm_layer.configure(&src, &dst, &mean, &variance, &beta, &gamma, epsilon); + + // Allocate tensors + src.allocator()->allocate(); + dst.allocator()->allocate(); + mean.allocator()->allocate(); + variance.allocator()->allocate(); + beta.allocator()->allocate(); + gamma.allocator()->allocate(); + + // Fill tensors + library->fill_tensor_uniform(Accessor(src), 0); + library->fill_tensor_uniform(Accessor(mean), 1); + library->fill_tensor_uniform(Accessor(variance), 2); + library->fill_tensor_uniform(Accessor(beta), 3); + library->fill_tensor_uniform(Accessor(gamma), 4); + } + + void run() + { + batch_norm_layer.run(); + } + + void teardown() + { + src.allocator()->free(); + dst.allocator()->free(); + mean.allocator()->free(); + variance.allocator()->free(); + beta.allocator()->free(); + gamma.allocator()->free(); + } + +private: + TensorType src{}; + TensorType dst{}; + TensorType mean{}; + TensorType variance{}; + TensorType beta{}; + TensorType gamma{}; + Function batch_norm_layer{}; +}; +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_BATCHNORMALIZATIONLAYERFIXTURE */ -- cgit v1.2.1