From 46023ed57210a0f72e6df457af8a8cd966d6565b Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Tue, 12 Nov 2019 16:26:26 +0000 Subject: COMPMID-2919 add error message for zero stride values The error message is added to function computing padding requirements. Change-Id: I2869577e587dbb8153b5abca4d63f3ba999e7e2f Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/2305 Reviewed-by: Pablo Marquez Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- src/core/Utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp index 9f1255dcaf..cbf6e48375 100644 --- a/src/core/Utils.cpp +++ b/src/core/Utils.cpp @@ -340,13 +340,15 @@ std::string arm_compute::lower_string(const std::string &val) PadStrideInfo arm_compute::calculate_same_pad(TensorShape input_shape, TensorShape weights_shape, PadStrideInfo conv_info, DataLayout data_layout, const Size2D &dilation, const DimensionRoundingType &rounding_type) { + const auto &strides = conv_info.stride(); + ARM_COMPUTE_ERROR_ON_MSG((strides.first < 1 || strides.second < 1), "Stride values should be greater than or equal to 1."); + const unsigned int width_idx = arm_compute::get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); const unsigned int height_idx = arm_compute::get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); const unsigned int in_width = input_shape[width_idx]; const unsigned int in_height = input_shape[height_idx]; const unsigned int kernel_width = weights_shape[width_idx]; const unsigned int kernel_height = weights_shape[height_idx]; - const auto &strides = conv_info.stride(); // Calculate output dimensions const auto is_ceil = static_cast(rounding_type == DimensionRoundingType::CEIL); -- cgit v1.2.1