diff options
author | SiCong Li <sicong.li@arm.com> | 2017-07-27 17:58:52 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | 1e5c1575fd7d86344b96988c86b82b66584460c8 (patch) | |
tree | ad263662d71ad70bdf01c25f88876f87ce38c919 /tests | |
parent | 0c9a8fdb88bfff9f2a7c4d00cb88b6519dd02f1b (diff) | |
download | ComputeLibrary-1e5c1575fd7d86344b96988c86b82b66584460c8.tar.gz |
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 <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests')
25 files changed, 1238 insertions, 167 deletions
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<CLTensor, CLActivationLayer, CLAccessor>; 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<CLTensor, CLBatchNormalizationLayer, CLAccessor>; + +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<CLTensor, CLConvolutionLayer, CLAccessor>; 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<CLTensor, CLDirectConvolutionLayer, CLAccessor>; 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<CLTensor, CLFullyConnectedLayer, CLAccessor>; 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<CLTensor, CLNormalizationLayer, CLAccessor>; @@ -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<CLTensor, CLPoolingLayer, CLAccessor>; 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<Tensor, NEActivationLaye TEST_SUITE(NEON) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetActivationLayer, NEActivationLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::AlexNetActivationLayerDataset(), alexnet_data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetActivationLayerDataset(), data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ActivationLayer, NEActivationLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ActivationLayerDataset(), lenet_data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ActivationLayerDataset(), data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetActivationLayer, NEActivationLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetActivationLayerDataset(), lenet_data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetActivationLayerDataset(), data_types), + framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetActivationLayer, NEActivationLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetActivationLayerDataset(), squeezenet_data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetActivationLayerDataset(), data_types), + framework::dataset::make("Batches", 1))); +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2ActivationLayer, NEActivationLayerFixture, 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, NEActivationLayerFixture, 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, NEActivationLayerFixture, 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, NEActivationLayerFixture, 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, NEActivationLayerFixture, 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, NEActivationLayerFixture, 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/NEON/BatchNormalizationLayer.cpp b/tests/benchmark_new/NEON/BatchNormalizationLayer.cpp new file mode 100644 index 0000000000..da0ccd493e --- /dev/null +++ b/tests/benchmark_new/NEON/BatchNormalizationLayer.cpp @@ -0,0 +1,65 @@ +/* + * 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. + */ +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/runtime/NEON/functions/NEBatchNormalizationLayer.h" +#include "arm_compute/runtime/Tensor.h" +#include "arm_compute/runtime/TensorAllocator.h" +#include "framework/Macros.h" +#include "framework/datasets/Datasets.h" +#include "tests/NEON/Accessor.h" +#include "tests/TypePrinter.h" + +#include "tests/datasets_new/YOLOV2BatchNormalizationLayerDataset.h" +#include "tests/fixtures_new/BatchNormalizationLayerFixture.h" + +namespace arm_compute +{ +namespace test +{ +namespace +{ +#ifdef ARM_COMPUTE_ENABLE_FP16 +const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QS8 }); +#else /* ARM_COMPUTE_ENABLE_FP16 */ +const auto data_types = framework::dataset::make("DataType", { DataType::F32, DataType::QS8 }); +#endif /* ARM_COMPUTE_ENABLE_FP16 */ +} // namespace + +using NEBatchNormalizationLayerFixture = BatchNormalizationLayerFixture<Tensor, NEBatchNormalizationLayer, Accessor>; + +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<Tensor, NEDirectConvol TEST_SUITE(NEON) -REGISTER_FIXTURE_DATA_TEST_CASE(DirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::DirectConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); - REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::AlexNetDirectConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetDirectConvolutionLayerDataset(), data_types), - framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::make("Batches", { 1, 4 }))); REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetDirectConvolutionLayer, 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(AlexNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetDirectConvolutionLayerDataset(), data_types), + framework::dataset::make("Batches", 8))); +REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetDirectConvolutionLayerDataset(), data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetDirectConvolutionLayer, NEConvolutionLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(), data_types), + framework::dataset::make("Batches", 8))); + +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2DirectConvolutionLayer, 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/FullyConnectedLayer.cpp b/tests/benchmark_new/NEON/FullyConnectedLayer.cpp index eb5612348a..daeb791977 100644 --- a/tests/benchmark_new/NEON/FullyConnectedLayer.cpp +++ b/tests/benchmark_new/NEON/FullyConnectedLayer.cpp @@ -39,25 +39,50 @@ namespace arm_compute { namespace test { +namespace +{ +#ifdef ARM_COMPUTE_ENABLE_FP16 +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::F32, DataType::QS8, DataType::QS16 }); +#endif /* ARM_COMPUTE_ENABLE_FP16 */ +} // namespace + using NEFullyConnectedLayerFixture = FullyConnectedLayerFixture<Tensor, NEFullyConnectedLayer, Accessor>; 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<Tensor, NENormalizationLayer, Accessor>; @@ -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<Tensor, NEPoolingLayer, Access TEST_SUITE(NEON) REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetPoolingLayer, NEPoolingLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::AlexNetPoolingLayerDataset(), alexnet_data_types), framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::AlexNetPoolingLayerDataset(), data_types), framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5PoolingLayer, NEPoolingLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::LeNet5PoolingLayerDataset(), lenet_data_types), framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::LeNet5PoolingLayerDataset(), data_types), framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetPoolingLayer, NEPoolingLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetPoolingLayerDataset(), lenet_data_types), framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetPoolingLayerDataset(), data_types), framework::dataset::make("Batches", 1))); REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetPoolingLayer, NEPoolingLayerFixture, framework::DatasetMode::ALL, - framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetPoolingLayerDataset(), squeezenet_data_types), framework::dataset::make("Batches", { 1, 4, 8 }))); + framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetPoolingLayerDataset(), data_types), framework::dataset::make("Batches", 1))); +REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2PoolingLayer, NEPoolingLayerFixture, 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, NEPoolingLayerFixture, 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, NEPoolingLayerFixture, 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, NEPoolingLayerFixture, 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, NEPoolingLayerFixture, 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, NEPoolingLayerFixture, 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/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::InitializerListDataset<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> +{ +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<TensorShape, TensorShape, float>; + + struct iterator + { + iterator(std::vector<TensorShape>::const_iterator tensor_it, + std::vector<TensorShape>::const_iterator param_it, + std::vector<float>::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<TensorShape>::const_iterator _tensor_it; + std::vector<TensorShape>::const_iterator _param_it; + std::vector<float>::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<TensorShape> _tensor_shapes{}; + std::vector<TensorShape> _param_shapes{}; + std::vector<float> _epsilons{}; +}; +} // namespace datasets +} // namespace test +} // namespace arm_compute +#endif /* ARM_COMPUTE_TEST_BATCHNORMALIZATION_LAYER_DATASET */ diff --git a/tests/datasets_new/ActivationLayerDataset.h b/tests/datasets_new/GoogLeNetActivationLayerDataset.h index a6b882fde2..935edbc4aa 100644 --- a/tests/datasets_new/ActivationLayerDataset.h +++ b/tests/datasets_new/GoogLeNetActivationLayerDataset.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_TEST_ACTIVATION_LAYER_DATASET -#define ARM_COMPUTE_TEST_ACTIVATION_LAYER_DATASET +#ifndef ARM_COMPUTE_TEST_GOOGLENET_ACTIVATION_LAYER_DATASET +#define ARM_COMPUTE_TEST_GOOGLENET_ACTIVATION_LAYER_DATASET #include "framework/datasets/Datasets.h" @@ -37,41 +37,6 @@ namespace test { namespace datasets { -class AlexNetActivationLayerDataset final : public - framework::dataset::CartesianProductDataset<framework::dataset::InitializerListDataset<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> -{ -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<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> -{ -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::InitializerListDataset<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> { @@ -152,42 +117,7 @@ public: GoogLeNetActivationLayerDataset(GoogLeNetActivationLayerDataset &&) = default; ~GoogLeNetActivationLayerDataset() = default; }; - -class SqueezeNetActivationLayerDataset final : public - framework::dataset::CartesianProductDataset<framework::dataset::InitializerListDataset<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> -{ -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 */ +#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<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> +{ +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::InitializerListDataset<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> +{ +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::InitializerListDataset<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> +{ +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::InitializerListDataset<TensorShape>, framework::dataset::SingletonDataset<ActivationLayerInfo>> +{ +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<YOLOV2ActivationLayerRELUDataset, YOLOV2ActivationLayerLINEARDataset> +{ +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 <typename TensorType, typename Function, typename Accessor> +class BatchNormalizationLayerFixture : public framework::Fixture +{ +public: + template <typename...> + 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<TensorType>(tensor_shape, data_type, 1, fixed_point_position); + dst = create_tensor<TensorType>(tensor_shape, data_type, 1, fixed_point_position); + mean = create_tensor<TensorType>(param_shape, data_type, 1, fixed_point_position); + variance = create_tensor<TensorType>(param_shape, data_type, 1, fixed_point_position); + beta = create_tensor<TensorType>(param_shape, data_type, 1, fixed_point_position); + gamma = create_tensor<TensorType>(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 */ |