aboutsummaryrefslogtreecommitdiff
path: root/src/core/Utils.cpp
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2017-11-23 09:49:51 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:42:33 +0000
commit780db4eb6a9e3dee565d14f36d772038cd3253da (patch)
tree53490d6a03bdeb26d77bc8840d1dbf6027e81f5c /src/core/Utils.cpp
parentd7ba5397b676c966cb5069c7187a12a0c35305f5 (diff)
downloadComputeLibrary-780db4eb6a9e3dee565d14f36d772038cd3253da.tar.gz
COMPMID-471 Implement Deconvolution on OpenCL
Change-Id: Ie00c6b08a51d30c5ce2637d40ee3d165b8a68686 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/110311 Reviewed-by: Pablo Tello <pablo.tello@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/Utils.cpp')
-rw-r--r--src/core/Utils.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp
index 76d0b0f059..a8249c4840 100644
--- a/src/core/Utils.cpp
+++ b/src/core/Utils.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016, 2017, 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -261,29 +261,17 @@ TensorShape arm_compute::deconvolution_output_shape(const std::pair<unsigned int
const 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 ax, unsigned int ay, float upscalex, float upscaley, DimensionRoundingType round)
+ unsigned int inner_border_right, unsigned int inner_border_top, unsigned int stride_x, unsigned int stride_y)
{
ARM_COMPUTE_ERROR_ON(in_width < 1 || in_height < 1);
- ARM_COMPUTE_ERROR_ON(((in_width - 1) * upscalex + kernel_width + ax) < 2.f * padx);
- ARM_COMPUTE_ERROR_ON(((in_height - 1) * upscaley + kernel_height + ay) < 2.f * pady);
- const float fw = (in_width - 1) * upscalex - 2.f * padx + kernel_width + ax;
- const float fh = (in_height - 1) * upscaley - 2.f * pady + kernel_height + ay;
- int w = 0;
- int h = 0;
- switch(round)
- {
- case DimensionRoundingType::FLOOR:
- w = std::floor(fw);
- h = std::floor(fh);
- break;
- case DimensionRoundingType::CEIL:
- w = std::ceil(fw);
- h = std::ceil(fh);
- break;
- default:
- ARM_COMPUTE_ERROR("Not supported");
- break;
- }
+ ARM_COMPUTE_ERROR_ON(((in_width - 1) * stride_x + kernel_width + inner_border_right) < 2 * padx);
+ ARM_COMPUTE_ERROR_ON(((in_height - 1) * stride_y + kernel_height + inner_border_top) < 2 * pady);
+ const int padx_deconv = (kernel_width - padx - 1);
+ const int pady_deconv = (kernel_height - pady - 1);
+ ARM_COMPUTE_ERROR_ON(padx_deconv < 0);
+ ARM_COMPUTE_ERROR_ON(pady_deconv < 0);
+ const int w = stride_x * (in_width - 1) + kernel_width + inner_border_right - 2 * padx_deconv;
+ const int h = stride_y * (in_height - 1) + kernel_height + inner_border_top - 2 * pady_deconv;
return std::make_pair<unsigned int, unsigned int>(w, h);
}