From 780db4eb6a9e3dee565d14f36d772038cd3253da Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 23 Nov 2017 09:49:51 +0000 Subject: COMPMID-471 Implement Deconvolution on OpenCL Change-Id: Ie00c6b08a51d30c5ce2637d40ee3d165b8a68686 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/110311 Reviewed-by: Pablo Tello Reviewed-by: Georgios Pinitas Tested-by: Jenkins --- src/core/Utils.cpp | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'src/core/Utils.cpp') 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 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(w, h); } -- cgit v1.2.1