blob: c2d695ecbf9c0ef6eba73c4ec42f21868394c577 [file] [log] [blame]
Giorgio Arena93a690e2017-08-01 16:09:33 +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_CLDEPTHWISECONVOLUTIONKERNEL_H__
25#define __ARM_COMPUTE_CLDEPTHWISECONVOLUTIONKERNEL_H__
26
27#include "arm_compute/core/CL/ICLKernel.h"
28
29namespace arm_compute
30{
31class ICLTensor;
32
33/** Interface for the kernel to run a 3x3 depthwise convolution on a tensor.
34 */
35class CLDepthwiseConvolutionKernel : public ICLKernel
36{
37public:
38 /** Default constructor */
39 CLDepthwiseConvolutionKernel();
40 /** Prevent instances of this class from being copied (As this class contains pointers) */
41 CLDepthwiseConvolutionKernel(const CLDepthwiseConvolutionKernel &) = delete;
42 /** Prevent instances of this class from being copied (As this class contains pointers) */
43 CLDepthwiseConvolutionKernel &operator=(const CLDepthwiseConvolutionKernel &) = delete;
44 /** Default Move Constructor. */
45 CLDepthwiseConvolutionKernel(CLDepthwiseConvolutionKernel &&) = default;
46 /** Default move assignment operator. */
47 CLDepthwiseConvolutionKernel &operator=(CLDepthwiseConvolutionKernel &&) = default;
48 /** Initialize the function's source, destination, conv and border_size.
49 *
50 * @param[in] input Source tensor. DataType supported: F32.
51 * @param[out] output Destination tensor. DataType supported: F32.
52 * @param[in] weights Weights tensor. These are 3D tensors with dimensions [3, 3, IFM]. Data type supported: Same as @p input.
53 * @param[in] conv_info Padding and stride information to use for the convolution. DataType supported: F32.
54 */
55 void configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *weights, const PadStrideInfo &conv_info);
56
57 // Inherited methods overridden:
58 void run(const Window &window, cl::CommandQueue &queue) override;
59 BorderSize border_size() const override;
60
61private:
62 BorderSize _border_size;
63 const ICLTensor *_input;
64 ICLTensor *_output;
65 const ICLTensor *_weights;
66 unsigned int _conv_stride_x;
67 unsigned int _conv_stride_y;
68 unsigned int _conv_pad_x;
69 unsigned int _conv_pad_y;
70};
71}
72#endif /*__ARM_COMPUTE_CLDEPTHWISECONVOLUTIONKERNEL_H__ */