• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2017-2019 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_GCDEPTHWISECONVOLUTIONKERNEL3x3_H
25 #define ARM_COMPUTE_GCDEPTHWISECONVOLUTIONKERNEL3x3_H
26 
27 #include "arm_compute/core/GLES_COMPUTE/IGCKernel.h"
28 
29 namespace arm_compute
30 {
31 class IGCTensor;
32 
33 /** Interface for the kernel to run a 3x3 depthwise convolution on a tensor.
34  */
35 class GCDepthwiseConvolutionLayer3x3Kernel : public IGCKernel
36 {
37 public:
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;
46     /** Default move assignment operator */
47     GCDepthwiseConvolutionLayer3x3Kernel &operator=(GCDepthwiseConvolutionLayer3x3Kernel &&) = default;
48     /** Initialize the function's source, destination, conv and border_size.
49      *
50      * @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.
57      */
58     void configure(const IGCTensor *input, const IGCTensor *weights, const IGCTensor *biases, IGCTensor *output, const PadStrideInfo &conv_info, unsigned int depth_multiplier = 1);
59 
60     // Inherited methods overridden:
61     void run(const Window &window) override;
62     BorderSize border_size() const override;
63 
64 private:
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
77 #endif /*ARM_COMPUTE_GCDEPTHWISECONVOLUTIONKERNEL3x3_H */
78