blob: 07c7c772c30fb14498de72dcd6de9428bd0571f3 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2017 ARM Limited.
3 *
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_CLWEIGHTSRESHAPEKERNEL_H__
25#define __ARM_COMPUTE_CLWEIGHTSRESHAPEKERNEL_H__
26
27#include "arm_compute/core/CL/ICLKernel.h"
28
29namespace arm_compute
30{
31class CLWeightsReshapeKernel : public ICLKernel
32{
33public:
Gian Marco Iodice5cb4c422017-06-23 10:38:25 +010034 /** Constructor.*/
35 CLWeightsReshapeKernel();
Anthony Barbier6ff3b192017-09-04 18:44:23 +010036 /** Prevent instances of this class from being copied (As this class contains pointers) */
37 CLWeightsReshapeKernel(const CLWeightsReshapeKernel &) = delete;
38 /** Prevent instances of this class from being copied (As this class contains pointers) */
39 CLWeightsReshapeKernel &operator=(const CLWeightsReshapeKernel &) = delete;
40 /** Allow instances of this class to be moved */
41 CLWeightsReshapeKernel(CLWeightsReshapeKernel &&) = default;
42 /** Allow instances of this class to be moved */
43 CLWeightsReshapeKernel &operator=(CLWeightsReshapeKernel &&) = default;
44 /** Default destructor */
45 ~CLWeightsReshapeKernel() = default;
46
47 /** Set the input and output of the kernel.
48 *
49 * @param[in] input The input tensor to convert. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM] if shared,
Gian Marco Iodice7d323a62017-07-05 20:05:23 +010050 * and 5D tensor with dimensions [kernel_x, kernel_y, IFM, OFM, num_patches] if unshared. Data types supported: QS8/QS16/F16/F32
Anthony Barbier6ff3b192017-09-04 18:44:23 +010051 * @param[in] biases The shared biases tensor to append. Bias is 1D tensor with dimensions [OFM] if shared and 2D tensor with
52 * dimensions [OFM, num_patches] if unshared. Data types supported: Same as @p input
53 * @param[out] output The output tensor. Should be a 2D Tensor. Data types supported: Same as @p input
54 */
55 void configure(const ICLTensor *input, const ICLTensor *biases, ICLTensor *output);
56
57 // Inherited methods overridden:
Gian Marco Iodice5cb4c422017-06-23 10:38:25 +010058 void run(const Window &window, cl::CommandQueue &queue) override;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010059
Gian Marco Iodice5cb4c422017-06-23 10:38:25 +010060private:
Anthony Barbier6ff3b192017-09-04 18:44:23 +010061 const ICLTensor *_input;
62 const ICLTensor *_biases;
63 ICLTensor *_output;
64};
Gian Marco Iodicef670a0a2017-09-18 12:20:45 +010065} // namespace arm_compute
Gian Marco Iodice13edbff2017-06-26 17:20:16 +010066#endif /*__ARM_COMPUTE_CLWEIGHTSRESHAPEKERNEL_H__ */