From 95643d83d8f4d0431b3983f771ca749963f6a966 Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Thu, 31 Aug 2017 17:10:18 +0100 Subject: COMPMID-417: Fix benchmark tests Change-Id: I4c4786c38fd3381015abbb9f1ef5612c712594b6 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/86019 Tested-by: Kaizen Reviewed-by: SiCong Li --- tests/TypePrinter.h | 2 +- .../GoogLeNetInceptionV4PoolingLayerDataset.h | 6 ++--- tests/networks_new/AlexNetNetwork.h | 29 +++++++++++++--------- 3 files changed, 21 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/TypePrinter.h b/tests/TypePrinter.h index 394ee9d87c..c207c1d634 100644 --- a/tests/TypePrinter.h +++ b/tests/TypePrinter.h @@ -360,7 +360,7 @@ inline std::string to_string(const PoolingType &type) /** Formatted output of @ref PoolingLayerInfo. */ inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info) { - os << info.pool_type(); + os << info.pool_type() << ";" << info.pool_size() << ";" << info.pad_stride_info(); return os; } diff --git a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h b/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h index 117d96bc4f..f0eb1eab42 100644 --- a/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h +++ b/tests/datasets_new/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h @@ -48,15 +48,15 @@ public: // inception_stem3_pool add_config(TensorShape(71U, 71U, 192U), TensorShape(35U, 35U, 192U), PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))); // inception_a1_pool_ave, inception_a2_pool_ave, inception_a3_pool_ave, inception_a4_pool_ave - add_config(TensorShape(35U, 35U, 384U), TensorShape(3U, 3U, 384U), PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL))); + add_config(TensorShape(35U, 35U, 384U), TensorShape(35U, 35U, 384U), PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL))); // reduction_a_pool add_config(TensorShape(35U, 35U, 384U), TensorShape(17U, 17U, 384U), PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))); // inception_b1_pool_ave, inception_b2_pool_ave, inception_b3_pool_ave, inception_b4_pool_ave, inception_b5_pool_ave, inception_b6_pool_ave, inception_b7_pool_ave - add_config(TensorShape(17U, 17U, 1024U), TensorShape(3U, 3U, 1024U), PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL))); + add_config(TensorShape(17U, 17U, 1024U), TensorShape(17U, 17U, 1024U), PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL))); // reduction_b_pool add_config(TensorShape(17U, 17U, 1024U), TensorShape(8U, 8U, 1024U), PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))); // inception_c1_pool_ave, inception_c2_pool_ave, inception_c3_pool_ave - add_config(TensorShape(8U, 8U, 1536U), TensorShape(3U, 3U, 1536U), PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL))); + add_config(TensorShape(8U, 8U, 1536U), TensorShape(8U, 8U, 1536U), PoolingLayerInfo(PoolingType::AVG, 3, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL))); } }; } // namespace datasets diff --git a/tests/networks_new/AlexNetNetwork.h b/tests/networks_new/AlexNetNetwork.h index b3a719671d..11171d6ec2 100644 --- a/tests/networks_new/AlexNetNetwork.h +++ b/tests/networks_new/AlexNetNetwork.h @@ -97,10 +97,15 @@ public: } else { - const unsigned int data_type_size = 16 / arm_compute::data_size_from_type(_data_type); + auto reshape = [&](unsigned int width, unsigned int height) -> TensorShape + { + const int interleave_width = 16 / arm_compute::data_size_from_type(_data_type); + + return TensorShape{ width * interleave_width, static_cast(std::ceil(static_cast(height) / interleave_width)) }; + }; // Create tensor for the reshaped weights - w[0].allocator()->init(TensorInfo(TensorShape(366U * data_type_size, 96U / data_type_size), 1, _data_type, _fixed_point_position)); + w[0].allocator()->init(TensorInfo(reshape(366U, 96U), 1, _data_type, _fixed_point_position)); // Configure the direct convolution's weights. Direct convolution doesn't need reshape weights if(!_is_direct_conv) @@ -111,13 +116,13 @@ public: auto w42_tensor = std::unique_ptr(new TensorType()); auto w51_tensor = std::unique_ptr(new TensorType()); auto w52_tensor = std::unique_ptr(new TensorType()); - w21_tensor->allocator()->init(TensorInfo(TensorShape(1248U * data_type_size, 128U / data_type_size), 1, _data_type, _fixed_point_position)); - w22_tensor->allocator()->init(TensorInfo(TensorShape(1248U * data_type_size, 128U / data_type_size), 1, _data_type, _fixed_point_position)); - w41_tensor->allocator()->init(TensorInfo(TensorShape(1920U * data_type_size, 192U / data_type_size), 1, _data_type, _fixed_point_position)); - w42_tensor->allocator()->init(TensorInfo(TensorShape(1920U * data_type_size, 192U / data_type_size), 1, _data_type, _fixed_point_position)); - w51_tensor->allocator()->init(TensorInfo(TensorShape(1920U * data_type_size, 128U / data_type_size), 1, _data_type, _fixed_point_position)); - w52_tensor->allocator()->init(TensorInfo(TensorShape(1920U * data_type_size, 128U / data_type_size), 1, _data_type, _fixed_point_position)); - w[2].allocator()->init(TensorInfo(TensorShape(2560U * data_type_size, 384U / data_type_size), 1, _data_type, _fixed_point_position)); + w21_tensor->allocator()->init(TensorInfo(reshape(1248U, 128U), 1, _data_type, _fixed_point_position)); + w22_tensor->allocator()->init(TensorInfo(reshape(1248U, 128U), 1, _data_type, _fixed_point_position)); + w41_tensor->allocator()->init(TensorInfo(reshape(1920U, 192U), 1, _data_type, _fixed_point_position)); + w42_tensor->allocator()->init(TensorInfo(reshape(1920U, 192U), 1, _data_type, _fixed_point_position)); + w51_tensor->allocator()->init(TensorInfo(reshape(1920U, 128U), 1, _data_type, _fixed_point_position)); + w52_tensor->allocator()->init(TensorInfo(reshape(1920U, 128U), 1, _data_type, _fixed_point_position)); + w[2].allocator()->init(TensorInfo(reshape(2560U, 384U), 1, _data_type, _fixed_point_position)); w21 = std::move(w21_tensor); w22 = std::move(w22_tensor); w41 = std::move(w41_tensor); @@ -157,9 +162,9 @@ public: if(_batches > 1 && std::is_same::value) { - w[5].allocator()->init(TensorInfo(TensorShape(9216U * data_type_size, 4096U / data_type_size), 1, _data_type, _fixed_point_position)); - w[6].allocator()->init(TensorInfo(TensorShape(4096U * data_type_size, 4096U / data_type_size), 1, _data_type, _fixed_point_position)); - w[7].allocator()->init(TensorInfo(TensorShape(4096U * data_type_size, 1000U / data_type_size), 1, _data_type, _fixed_point_position)); + w[5].allocator()->init(TensorInfo(reshape(9216U, 4096U), 1, _data_type, _fixed_point_position)); + w[6].allocator()->init(TensorInfo(reshape(4096U, 4096U), 1, _data_type, _fixed_point_position)); + w[7].allocator()->init(TensorInfo(reshape(4096U, 1000U), 1, _data_type, _fixed_point_position)); } else { -- cgit v1.2.1