aboutsummaryrefslogtreecommitdiff
path: root/src/core/Utils.cpp
diff options
context:
space:
mode:
authorMatthew Jackson <matthew.jackson@arm.com>2019-08-22 16:13:27 +0100
committerMatthew Jackson <matthew.jackson@arm.com>2019-08-28 09:22:18 +0000
commitb9070a42a44ec1a0102e2f0b04523d2e96392903 (patch)
tree476ae6897e26380a00e4ccfdcd315d6b6f884622 /src/core/Utils.cpp
parent275f99cb09606191c5589952d57175be655de74a (diff)
downloadComputeLibrary-b9070a42a44ec1a0102e2f0b04523d2e96392903.tar.gz
COMPMID-2605: Add asymmetric padding support for Deconvolution layer
Change-Id: I63b773bdce25f1342ccd3a08ded623a1508f70fe Signed-off-by: Matthew Jackson <matthew.jackson@arm.com> Reviewed-on: https://review.mlplatform.org/c/1797 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com>
Diffstat (limited to 'src/core/Utils.cpp')
-rw-r--r--src/core/Utils.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp
index 122373f5c6..d11788acd3 100644
--- a/src/core/Utils.cpp
+++ b/src/core/Utils.cpp
@@ -374,15 +374,22 @@ PadStrideInfo arm_compute::calculate_same_pad(TensorShape input_shape, TensorSha
return same_info;
}
-std::pair<unsigned int, unsigned int> arm_compute::deconvolution_output_dimensions(
- unsigned int in_width, unsigned int in_height, unsigned int kernel_width, unsigned int kernel_height, unsigned int padx, unsigned int pady,
- unsigned int stride_x, unsigned int stride_y)
+std::pair<unsigned int, unsigned int> arm_compute::deconvolution_output_dimensions(unsigned int in_width, unsigned int in_height,
+ unsigned int kernel_width, unsigned int kernel_height,
+ const PadStrideInfo &pad_stride_info)
{
+ const unsigned int pad_left = pad_stride_info.pad_left();
+ const unsigned int pad_top = pad_stride_info.pad_top();
+ const unsigned int pad_right = pad_stride_info.pad_right();
+ const unsigned int pad_bottom = pad_stride_info.pad_bottom();
+ const unsigned int stride_x = pad_stride_info.stride().first;
+ const unsigned int stride_y = pad_stride_info.stride().second;
+
ARM_COMPUTE_ERROR_ON(in_width < 1 || in_height < 1);
- ARM_COMPUTE_ERROR_ON(((in_width - 1) * stride_x + kernel_width) < 2 * padx);
- ARM_COMPUTE_ERROR_ON(((in_height - 1) * stride_y + kernel_height) < 2 * pady);
- const int w = stride_x * (in_width - 1) + kernel_width - 2 * padx;
- const int h = stride_y * (in_height - 1) + kernel_height - 2 * pady;
+ ARM_COMPUTE_ERROR_ON(((in_width - 1) * stride_x + kernel_width) < (pad_left + pad_right));
+ ARM_COMPUTE_ERROR_ON(((in_height - 1) * stride_y + kernel_height) < (pad_top + pad_bottom));
+ const int w = stride_x * (in_width - 1) + kernel_width - (pad_left + pad_right);
+ const int h = stride_y * (in_height - 1) + kernel_height - (pad_top + pad_bottom);
return std::make_pair<unsigned int, unsigned int>(w, h);
}