From 4074c995d2a88684fd4a9d1aa36d51de56bb8dab Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 30 Jan 2018 18:13:46 +0000 Subject: COMPMID-873: Integrate RSH NEON Depthwise Convolution routine Change-Id: Ida1e9a836bc518bfe5563e16bf7f92bde5fc13f7 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/118472 Tested-by: Jenkins Reviewed-by: Pablo Tello --- src/core/Utils.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/core/Utils.cpp') diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp index 83a843de58..f4b45532cf 100644 --- a/src/core/Utils.cpp +++ b/src/core/Utils.cpp @@ -250,6 +250,21 @@ std::string arm_compute::lower_string(const std::string &val) return res; } +PadStrideInfo arm_compute::calculate_same_pad(TensorShape input_shape, TensorShape weights_shape, PadStrideInfo conv_info) +{ + const auto &strides = conv_info.stride(); + const int out_width = std::ceil(float(input_shape.x()) / float(strides.first)); + const int out_height = std::ceil(float(input_shape.y()) / float(strides.second)); + const int pad_width = ((out_width - 1) * strides.first + weights_shape.x() - input_shape.x()); + const int pad_height = ((out_height - 1) * strides.second + weights_shape.y() - input_shape.y()); + const int same_pad_left = pad_width / 2; + const int same_pad_top = pad_height / 2; + const int same_pad_right = pad_width - same_pad_left; + const int same_pad_bottom = pad_height - same_pad_top; + + return PadStrideInfo(strides.first, strides.second, same_pad_left, same_pad_right, same_pad_top, same_pad_bottom, DimensionRoundingType::CEIL); +} + TensorShape arm_compute::deconvolution_output_shape(const std::pair &out_dims, TensorShape input, TensorShape weights) { TensorShape out_shape(input); -- cgit v1.2.1