From 393fa4c87c84356132303170d1b9ce9a45b3c3bf Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 8 May 2018 15:54:53 +0100 Subject: COMPMID-814: NEScale NHWC support Change-Id: Ibf5c624a5c5482faa42eb02bc8abe9ae0d65b0d1 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/130608 Tested-by: Jenkins Reviewed-by: Anthony Barbier --- tests/benchmark/fixtures/ScaleFixture.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tests/benchmark/fixtures/ScaleFixture.h') 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 - 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 distribution_float(0.25f, 3.0f); float scale_x = distribution_float(generator); @@ -57,9 +63,12 @@ public: std::uniform_int_distribution distribution_u8(0, 255); uint8_t constant_border_value = static_cast(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(shape, data_type); -- cgit v1.2.1