blob: 8faa54a205ee908ba2c2c1ea7f174ad2787f542a [file] [log] [blame]
Frank Lei8cdfdb82018-01-02 16:49:33 +08001/*
Michalis Spyrouf4643372019-11-29 16:17:13 +00002 * Copyright (c) 2017-2019 ARM Limited.
Frank Lei8cdfdb82018-01-02 16:49:33 +08003 *
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_GCDEPTHWISECONVOLUTIONKERNEL3x3_H
25#define ARM_COMPUTE_GCDEPTHWISECONVOLUTIONKERNEL3x3_H
Frank Lei8cdfdb82018-01-02 16:49:33 +080026
27#include "arm_compute/core/GLES_COMPUTE/IGCKernel.h"
28
29namespace arm_compute
30{
31class IGCTensor;
32
33/** Interface for the kernel to run a 3x3 depthwise convolution on a tensor.
34 */
35class GCDepthwiseConvolutionLayer3x3Kernel : public IGCKernel
36{
37public:
38 /** Default constructor */
39 GCDepthwiseConvolutionLayer3x3Kernel();
40 /** Prevent instances of this class from being copied (As this class contains pointers) */
41 GCDepthwiseConvolutionLayer3x3Kernel(const GCDepthwiseConvolutionLayer3x3Kernel &) = delete;
42 /** Prevent instances of this class from being copied (As this class contains pointers) */
43 GCDepthwiseConvolutionLayer3x3Kernel &operator=(const GCDepthwiseConvolutionLayer3x3Kernel &) = delete;
44 /** Default Move Constructor. */
45 GCDepthwiseConvolutionLayer3x3Kernel(GCDepthwiseConvolutionLayer3x3Kernel &&) = default;
Alex Gildayc357c472018-03-21 13:54:09 +000046 /** Default move assignment operator */
Frank Lei8cdfdb82018-01-02 16:49:33 +080047 GCDepthwiseConvolutionLayer3x3Kernel &operator=(GCDepthwiseConvolutionLayer3x3Kernel &&) = default;
48 /** Initialize the function's source, destination, conv and border_size.
49 *
Giorgio Arena76572242018-04-04 17:44:26 +010050 * @param[in] input Source tensor. DataType supported: F16.
51 * @param[in] weights Weights tensor. A 3D tensor with dimensions [3, 3, IFM]. Data type supported: Same as @p input.
52 * @param[in] biases (Optional) Biases tensor. A 1D tensor with dimensions [IFM]. Must be nullptr if not needed.
53 * Data type supported: Same as @p input.
54 * @param[out] output Destination tensor. Data type supported: Same as @p input.
55 * @param[in] conv_info Padding and stride information to use for the convolution.
56 * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
Frank Lei8cdfdb82018-01-02 16:49:33 +080057 */
Giorgio Arena76572242018-04-04 17:44:26 +010058 void configure(const IGCTensor *input, const IGCTensor *weights, const IGCTensor *biases, IGCTensor *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier = 1);
Frank Lei8cdfdb82018-01-02 16:49:33 +080059
60 // Inherited methods overridden:
61 void run(const Window &window) override;
62 BorderSize border_size() const override;
63
64private:
65 BorderSize _border_size;
66 const IGCTensor *_input;
67 IGCTensor *_output;
68 const IGCTensor *_weights;
69 const IGCTensor *_biases;
70 unsigned int _conv_stride_x;
71 unsigned int _conv_stride_y;
72 unsigned int _conv_pad_left;
73 unsigned int _conv_pad_top;
74 gles::NDRange _lws;
75};
76} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +000077#endif /*ARM_COMPUTE_GCDEPTHWISECONVOLUTIONKERNEL3x3_H */