blob: d96fb5677117453a1f6253b032946aef77a770b8 [file] [log] [blame]
Anthony Barbier7068f992017-10-26 15:23:08 +01001/*
Michalis Spyrouf4643372019-11-29 16:17:13 +00002 * Copyright (c) 2017-2019 ARM Limited.
Anthony Barbier7068f992017-10-26 15:23:08 +01003 *
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
Michalis Spyrouf4643372019-11-29 16:17:13 +000025#ifndef ARM_COMPUTE_GCCOL2IMKERNEL_H
26#define ARM_COMPUTE_GCCOL2IMKERNEL_H
Anthony Barbier7068f992017-10-26 15:23:08 +010027
28#include "arm_compute/core/GLES_COMPUTE/IGCKernel.h"
29
30namespace arm_compute
31{
32class IGCTensor;
33
34/** Interface for the col2im reshaping kernel.
35 *
36 * Rearranges each matrix column into image blocks. It's the inverse operation of @ref GCIm2ColKernel.
37 *
38 * For example, a vector of 9 elements can be reshaped to a block(image) of 3x3:
39 *
40 * @f[
41 * \left( \begin{array}{ccccccccc}
42 * a0 & a1 & a2 & a3 & a4 & a5 & a6 & a7 & a8 \\
43 * \end{array} \right)
44 * \rightarrow
45 * \left( \begin{array}{ccc}
46 * a0 & a1 & a2 \\
47 * a3 & a4 & a5 \\
48 * a6 & a7 & a8 \\
49 * \end{array} \right)
50 * @f]
51 */
52class GCCol2ImKernel : public IGCKernel
53{
54public:
55 /** Default constructor */
56 GCCol2ImKernel();
57
58 /** Prevent instances of this class from being copied (As this class contains pointers) */
59 GCCol2ImKernel(const GCCol2ImKernel &) = delete;
60
61 /** Prevent instances of this class from being copied (As this class contains pointers) */
62 GCCol2ImKernel &operator=(const GCCol2ImKernel &) = delete;
63
64 /** Allow instances of this class to be moved */
65 GCCol2ImKernel(GCCol2ImKernel &&) = default;
66
67 /** Allow instances of this class to be moved */
68 GCCol2ImKernel &operator=(GCCol2ImKernel &&) = default;
69
70 /** Default destructor */
71 ~GCCol2ImKernel() = default;
72
73 /** Set the input and output of the kernel.
74 *
Stephen Lie855c232018-01-04 14:13:22 +080075 * @param[in] input The input tensor to convert. Data types supported: F16/F32
Anthony Barbier7068f992017-10-26 15:23:08 +010076 * @param[out] output The output tensor. 3 lower dimensions represent a single output [width, height, OFM],
77 * while the rest represent batch of outputs. Data types supported: Same as @p input
78 * @param[in] convolved_dims Output convolved dimensions.
79 */
80 void configure(const IGCTensor *input, IGCTensor *output, std::pair<unsigned int, unsigned int> convolved_dims);
81
82 // Inherited methods overridden:
83 void run(const Window &window) override;
84
85private:
86 const IGCTensor *_input;
87 IGCTensor *_output;
88 std::pair<unsigned int, unsigned int> _convolved_dims;
89};
90}
91
Michalis Spyrouf4643372019-11-29 16:17:13 +000092#endif /*ARM_COMPUTE_GCCOL2IMKERNEL_H */