blob: 6f015744bfebf83795f534d5a07e81b8b52ec3b2 [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 */
Michalis Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_CLDECONVOLUTIONLAYERUPSAMPLE_H
25#define ARM_COMPUTE_CLDECONVOLUTIONLAYERUPSAMPLE_H
Michalis Spyrou780db4e2017-11-23 09:49:51 +000026
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"
Michalis Spyrou780db4e2017-11-23 09:49:51 +000032#include "arm_compute/runtime/IFunction.h"
Michalis Spyrou780db4e2017-11-23 09:49:51 +000033
34namespace arm_compute
35{
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010036// Forward declarations
Michalis Spyrou780db4e2017-11-23 09:49:51 +000037class ICLTensor;
38
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010039/** Basic function to execute deconvolution upsample on OpenCL. This function calls the following OpenCL kernels and functions:
40 *
41 * -# @ref CLMemsetKernel
42 * -# @ref CLDeconvolutionLayerUpsampleKernel
43 */
Michalis Spyrou780db4e2017-11-23 09:49:51 +000044class CLDeconvolutionLayerUpsample : public IFunction
45{
46public:
47 /** Default constructor */
48 CLDeconvolutionLayerUpsample();
49 /** Prevent instances of this class from being copied (As this class contains pointers) */
50 CLDeconvolutionLayerUpsample(const CLDeconvolutionLayerUpsample &) = delete;
51 /** Prevent instances of this class from being copied (As this class contains pointers) */
52 CLDeconvolutionLayerUpsample &operator=(const CLDeconvolutionLayerUpsample &) = delete;
53 /** Allow instances of this class to be moved */
54 CLDeconvolutionLayerUpsample(CLDeconvolutionLayerUpsample &&) = default;
55 /** Allow instances of this class to be moved */
56 CLDeconvolutionLayerUpsample &operator=(CLDeconvolutionLayerUpsample &&) = default;
57 /** Default destructor */
58 virtual ~CLDeconvolutionLayerUpsample() = default;
59
60 /** Initialize the function's source, destination, interpolation type and border_mode.
61 *
Manuel Bottinic1b76fa2019-06-17 12:04:40 +010062 * @param[in, out] input Source tensor. Data type supported: QASYMM8/F16/F32.
63 * @param[out] output Destination tensor. Data type supported: same as @p input.
64 * @param[in] info Contains padding and policies to be used in the deconvolution.
Michalis Spyrou780db4e2017-11-23 09:49:51 +000065 */
Manuel Bottinic1b76fa2019-06-17 12:04:40 +010066 void configure(ICLTensor *input, ICLTensor *output, const PadStrideInfo &info);
Michalis Spyrou780db4e2017-11-23 09:49:51 +000067 /** Static function to check if given info will lead to a valid configuration of @ref CLDeconvolutionLayerUpsample
68 *
Manuel Bottinic1b76fa2019-06-17 12:04:40 +010069 * @param[in] input Source tensor info. Data type supported: QASYMM8/F16/F32.
70 * @param[in] output Destination tensor info. Data type supported: same as @p input.
71 * @param[in] info Contains padding and policies to be used in the deconvolution.
Michalis Spyrou780db4e2017-11-23 09:49:51 +000072 *
73 * @return a status
74 */
Manuel Bottinic1b76fa2019-06-17 12:04:40 +010075 static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &info);
Michalis Spyrou780db4e2017-11-23 09:49:51 +000076
77 // Inherited methods overridden:
78 void run() override;
79
80private:
81 CLDeconvolutionLayerUpsampleKernel _upsample;
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010082 CLMemsetKernel _memset;
Michalis Spyrou780db4e2017-11-23 09:49:51 +000083 ICLTensor *_output;
84};
Georgios Pinitasdbfc2dc2019-04-02 12:51:21 +010085} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +000086#endif /* ARM_COMPUTE_CLDECONVOLUTIONLAYERUPSAMPLE_H */