blob: cab252f0ea4f9c94f1c9d15d9b22d2c0d829b0bb [file] [log] [blame]
Michalis Spyrou780db4e2017-11-23 09:49:51 +00001/*
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +01002 * Copyright (c) 2017-2019 ARM Limited.
Michalis Spyrou780db4e2017-11-23 09:49:51 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef __ARM_COMPUTE_CLDECONVOLUTIONLAYERUPSAMPLE_H__
25#define __ARM_COMPUTE_CLDECONVOLUTIONLAYERUPSAMPLE_H__
26
27#include "arm_compute/runtime/IFunction.h"
28
29#include "arm_compute/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.h"
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010030#include "arm_compute/core/CL/kernels/CLMemsetKernel.h"
Michalis Spyrou780db4e2017-11-23 09:49:51 +000031#include "arm_compute/core/Types.h"
32#include "arm_compute/runtime/CL/CLMemoryGroup.h"
33#include "arm_compute/runtime/IFunction.h"
34#include "arm_compute/runtime/IMemoryManager.h"
35
36namespace arm_compute
37{
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010038// Forward declarations
Michalis Spyrou780db4e2017-11-23 09:49:51 +000039class ICLTensor;
40
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010041/** Basic function to execute deconvolution upsample on OpenCL. This function calls the following OpenCL kernels and functions:
42 *
43 * -# @ref CLMemsetKernel
44 * -# @ref CLDeconvolutionLayerUpsampleKernel
45 */
Michalis Spyrou780db4e2017-11-23 09:49:51 +000046class CLDeconvolutionLayerUpsample : public IFunction
47{
48public:
49 /** Default constructor */
50 CLDeconvolutionLayerUpsample();
51 /** Prevent instances of this class from being copied (As this class contains pointers) */
52 CLDeconvolutionLayerUpsample(const CLDeconvolutionLayerUpsample &) = delete;
53 /** Prevent instances of this class from being copied (As this class contains pointers) */
54 CLDeconvolutionLayerUpsample &operator=(const CLDeconvolutionLayerUpsample &) = delete;
55 /** Allow instances of this class to be moved */
56 CLDeconvolutionLayerUpsample(CLDeconvolutionLayerUpsample &&) = default;
57 /** Allow instances of this class to be moved */
58 CLDeconvolutionLayerUpsample &operator=(CLDeconvolutionLayerUpsample &&) = default;
59 /** Default destructor */
60 virtual ~CLDeconvolutionLayerUpsample() = default;
61
62 /** Initialize the function's source, destination, interpolation type and border_mode.
63 *
Manuel Bottinic1b76fa2019-06-17 12:04:40 +010064 * @param[in, out] input Source tensor. Data type supported: QASYMM8/F16/F32.
65 * @param[out] output Destination tensor. Data type supported: same as @p input.
66 * @param[in] info Contains padding and policies to be used in the deconvolution.
Michalis Spyrou780db4e2017-11-23 09:49:51 +000067 */
Manuel Bottinic1b76fa2019-06-17 12:04:40 +010068 void configure(ICLTensor *input, ICLTensor *output, const PadStrideInfo &info);
Michalis Spyrou780db4e2017-11-23 09:49:51 +000069 /** Static function to check if given info will lead to a valid configuration of @ref CLDeconvolutionLayerUpsample
70 *
Manuel Bottinic1b76fa2019-06-17 12:04:40 +010071 * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32.
72 * @param[in] output Destination tensor info. Data type supported: same as @p input.
73 * @param[in] info Contains padding and policies to be used in the deconvolution.
Michalis Spyrou780db4e2017-11-23 09:49:51 +000074 *
75 * @return a status
76 */
Manuel Bottinic1b76fa2019-06-17 12:04:40 +010077 static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &info);
Michalis Spyrou780db4e2017-11-23 09:49:51 +000078
79 // Inherited methods overridden:
80 void run() override;
81
82private:
83 CLDeconvolutionLayerUpsampleKernel _upsample;
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010084 CLMemsetKernel _memset;
Michalis Spyrou780db4e2017-11-23 09:49:51 +000085 ICLTensor *_output;
86};
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010087} // namespace arm_compute
Michalis Spyrou780db4e2017-11-23 09:49:51 +000088#endif /* __ARM_COMPUTE_CLDECONVOLUTIONLAYERUPSAMPLE_H__ */