diff options
-rw-r--r-- | tests/benchmark/CL/SoftmaxLayer.cpp | 9 | ||||
-rw-r--r-- | tests/benchmark/NEON/SoftmaxLayer.cpp | 57 | ||||
-rw-r--r-- | tests/benchmark/fixtures/SoftmaxLayerFixture.h | 7 |
3 files changed, 63 insertions, 10 deletions
diff --git a/tests/benchmark/CL/SoftmaxLayer.cpp b/tests/benchmark/CL/SoftmaxLayer.cpp index 6f0918fd95..ff7d5fdeaa 100644 --- a/tests/benchmark/CL/SoftmaxLayer.cpp +++ b/tests/benchmark/CL/SoftmaxLayer.cpp @@ -39,22 +39,19 @@ namespace test { namespace { -const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 }); +const auto data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::QASYMM8, DataType::QS16, DataType::F16, DataType::F32 }); } // namespace using CLSoftmaxLayerFixture = SoftmaxLayerFixture<CLTensor, CLSoftmaxLayer, CLAccessor>; TEST_SUITE(CL) -REGISTER_FIXTURE_DATA_TEST_CASE(SoftmaxLayer, CLSoftmaxLayerFixture, framework::DatasetMode::ALL, +REGISTER_FIXTURE_DATA_TEST_CASE(SoftmaxLayerSmall, CLSoftmaxLayerFixture, framework::DatasetMode::ALL, framework::dataset::combine(datasets::SoftmaxLayerSmallShapes(), data_types)); -TEST_SUITE(NIGHTLY) - -REGISTER_FIXTURE_DATA_TEST_CASE(SoftmaxLayer, CLSoftmaxLayerFixture, framework::DatasetMode::NIGHTLY, +REGISTER_FIXTURE_DATA_TEST_CASE(SoftmaxLayerLarge, CLSoftmaxLayerFixture, framework::DatasetMode::NIGHTLY, framework::dataset::combine(datasets::SoftmaxLayerLargeShapes(), data_types)); TEST_SUITE_END() -TEST_SUITE_END() } // namespace test } // namespace arm_compute diff --git a/tests/benchmark/NEON/SoftmaxLayer.cpp b/tests/benchmark/NEON/SoftmaxLayer.cpp new file mode 100644 index 0000000000..399d581e79 --- /dev/null +++ b/tests/benchmark/NEON/SoftmaxLayer.cpp @@ -0,0 +1,57 @@ +/* + * 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/NESoftmaxLayer.h" +#include "arm_compute/runtime/Tensor.h" +#include "arm_compute/runtime/TensorAllocator.h" +#include "tests/NEON/Accessor.h" +#include "tests/benchmark/fixtures/SoftmaxLayerFixture.h" +#include "tests/datasets/ShapeDatasets.h" +#include "tests/framework/Macros.h" +#include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" + +namespace arm_compute +{ +namespace test +{ +namespace +{ +const auto data_types = framework::dataset::make("DataType", { DataType::QS8, DataType::QS16, DataType::F32 }); +} // namespace + +using NESoftmaxLayerFixture = SoftmaxLayerFixture<Tensor, NESoftmaxLayer, Accessor>; + +TEST_SUITE(NEON) + +REGISTER_FIXTURE_DATA_TEST_CASE(SoftmaxLayerSmall, NESoftmaxLayerFixture, framework::DatasetMode::ALL, + framework::dataset::combine(datasets::SoftmaxLayerSmallShapes(), data_types)); + +REGISTER_FIXTURE_DATA_TEST_CASE(SoftmaxLayerLarge, NESoftmaxLayerFixture, framework::DatasetMode::NIGHTLY, + framework::dataset::combine(datasets::SoftmaxLayerLargeShapes(), data_types)); + +TEST_SUITE_END() +} // namespace test +} // namespace arm_compute diff --git a/tests/benchmark/fixtures/SoftmaxLayerFixture.h b/tests/benchmark/fixtures/SoftmaxLayerFixture.h index 6e0472ce3a..50b272621e 100644 --- a/tests/benchmark/fixtures/SoftmaxLayerFixture.h +++ b/tests/benchmark/fixtures/SoftmaxLayerFixture.h @@ -50,12 +50,11 @@ public: template <typename...> void setup(TensorShape shape, DataType data_type) { - // Set batched in source and destination shapes - const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0; + const unsigned int fixed_point_position = 4; // Create tensors - src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position); - dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position); + src = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, QuantizationInfo(1.f / 256, 10)); + dst = create_tensor<TensorType>(shape, data_type, 1, fixed_point_position, QuantizationInfo(1.f / 256, 0)); ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); |