diff options
Diffstat (limited to 'tests/benchmark')
-rw-r--r-- | tests/benchmark/CL/Scale.cpp | 8 | ||||
-rw-r--r-- | tests/benchmark/NEON/Scale.cpp | 8 | ||||
-rw-r--r-- | tests/benchmark/fixtures/ScaleFixture.h | 15 |
3 files changed, 22 insertions, 9 deletions
diff --git a/tests/benchmark/CL/Scale.cpp b/tests/benchmark/CL/Scale.cpp index a1cc0a5640..98f64f164b 100644 --- a/tests/benchmark/CL/Scale.cpp +++ b/tests/benchmark/CL/Scale.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -50,11 +50,13 @@ using CLScaleFixture = ScaleFixture<CLTensor, CLScale, CLAccessor>; TEST_SUITE(CL) TEST_SUITE(Scale) -REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallImageShapes(), framework::dataset::make("DataType", { DataType::F16, DataType::F32 })), +REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, CLScaleFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallImageShapes(), framework::dataset::make("DataType", { DataType::F16, DataType::F32 })), + framework::dataset::make("DataLayout", { DataLayout::NCHW })), interpolation_types), datasets::BorderModes()), datasets::SamplingPolicies())); -REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeImageShapes(), framework::dataset::make("DataType", { DataType::F16, DataType::F32 })), +REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, CLScaleFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeImageShapes(), framework::dataset::make("DataType", { DataType::F16, DataType::F32 })), + framework::dataset::make("DataLayout", { DataLayout::NCHW })), interpolation_types), datasets::BorderModes()), datasets::SamplingPolicies())); diff --git a/tests/benchmark/NEON/Scale.cpp b/tests/benchmark/NEON/Scale.cpp index 9b2f0bc867..b75d1a6464 100644 --- a/tests/benchmark/NEON/Scale.cpp +++ b/tests/benchmark/NEON/Scale.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -49,11 +49,13 @@ using NEScaleFixture = ScaleFixture<Tensor, NEScale, Accessor>; TEST_SUITE(NEON) TEST_SUITE(Scale) -REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEScaleFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(datasets::SmallImageShapes(), framework::dataset::make("DataType", { DataType::U8, DataType::S16, DataType::F32 })), +REGISTER_FIXTURE_DATA_TEST_CASE(RunSmall, NEScaleFixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(combine(datasets::SmallImageShapes(), framework::dataset::make("DataType", { DataType::U8, DataType::S16, DataType::F32 })), + framework::dataset::make("DataLayout", { DataLayout::NCHW })), interpolation_types), datasets::BorderModes()), framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER }))); -REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEScaleFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(datasets::LargeImageShapes(), framework::dataset::make("DataType", { DataType::U8, DataType::S16, DataType::F32 })), +REGISTER_FIXTURE_DATA_TEST_CASE(RunLarge, NEScaleFixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(combine(datasets::LargeImageShapes(), framework::dataset::make("DataType", { DataType::U8, DataType::S16, DataType::F32 })), + framework::dataset::make("DataLayout", { DataLayout::NCHW })), interpolation_types), datasets::BorderModes()), framework::dataset::make("SamplingPolicy", { SamplingPolicy::CENTER }))); diff --git a/tests/benchmark/fixtures/ScaleFixture.h b/tests/benchmark/fixtures/ScaleFixture.h index cd51f5778f..b2fbd9c3b6 100644 --- a/tests/benchmark/fixtures/ScaleFixture.h +++ b/tests/benchmark/fixtures/ScaleFixture.h @@ -41,11 +41,17 @@ class ScaleFixture : public framework::Fixture { public: template <typename...> - void setup(TensorShape shape, DataType data_type, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy) + void setup(TensorShape shape, DataType data_type, DataLayout data_layout, InterpolationPolicy policy, BorderMode border_mode, SamplingPolicy sampling_policy) { constexpr float max_width = 8192.0f; constexpr float max_height = 6384.0f; + // Change shape in case of NHWC. + if(data_layout == DataLayout::NHWC) + { + permute(shape, PermutationVector(2U, 0U, 1U)); + } + std::mt19937 generator(library->seed()); std::uniform_real_distribution<float> distribution_float(0.25f, 3.0f); float scale_x = distribution_float(generator); @@ -57,9 +63,12 @@ public: std::uniform_int_distribution<uint8_t> distribution_u8(0, 255); uint8_t constant_border_value = static_cast<uint8_t>(distribution_u8(generator)); + const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); + const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); + TensorShape shape_scaled(shape); - shape_scaled.set(0, shape[0] * scale_x); - shape_scaled.set(1, shape[1] * scale_y); + shape_scaled.set(idx_width, shape[idx_width] * scale_x); + shape_scaled.set(idx_height, shape[idx_height] * scale_y); // Create tensors src = create_tensor<TensorType>(shape, data_type); |