aboutsummaryrefslogtreecommitdiff
path: root/src/core/Utils.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-01-30 18:13:46 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:46:07 +0000
commit4074c995d2a88684fd4a9d1aa36d51de56bb8dab (patch)
tree280a15ca10ff88c5eb432be011ccb721660a3349 /src/core/Utils.cpp
parentc5694afca3f937f8c9b3ec328da9394f11f9af2d (diff)
downloadComputeLibrary-4074c995d2a88684fd4a9d1aa36d51de56bb8dab.tar.gz
COMPMID-873: Integrate RSH NEON Depthwise Convolution routine
Change-Id: Ida1e9a836bc518bfe5563e16bf7f92bde5fc13f7 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/118472 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'src/core/Utils.cpp')
-rw-r--r--src/core/Utils.cpp15
1 files changed, 15 insertions, 0 deletions
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<unsigned int, unsigned int> &out_dims, TensorShape input, TensorShape weights)
{
TensorShape out_shape(input);