2 * Copyright (c) 2017-2018 ARM Limited.
4 * SPDX-License-Identifier: MIT
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:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
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
24 #ifndef __ARM_COMPUTE_CLDEPTHWISECONVOLUTIONKERNEL3x3_H__
25 #define __ARM_COMPUTE_CLDEPTHWISECONVOLUTIONKERNEL3x3_H__
27 #include "arm_compute/core/CL/ICLKernel.h"
33 /** Interface for the kernel to run a 3x3 depthwise convolution on a tensor.
35 class CLDepthwiseConvolutionLayer3x3Kernel : public ICLKernel
38 /** Default constructor */
39 CLDepthwiseConvolutionLayer3x3Kernel();
40 /** Prevent instances of this class from being copied (As this class contains pointers) */
41 CLDepthwiseConvolutionLayer3x3Kernel(const CLDepthwiseConvolutionLayer3x3Kernel &) = delete;
42 /** Prevent instances of this class from being copied (As this class contains pointers) */
43 CLDepthwiseConvolutionLayer3x3Kernel &operator=(const CLDepthwiseConvolutionLayer3x3Kernel &) = delete;
44 /** Default Move Constructor. */
45 CLDepthwiseConvolutionLayer3x3Kernel(CLDepthwiseConvolutionLayer3x3Kernel &&) = default;
46 /** Default move assignment operator. */
47 CLDepthwiseConvolutionLayer3x3Kernel &operator=(CLDepthwiseConvolutionLayer3x3Kernel &&) = default;
48 /** Initialize the function's source, destination, conv and border_size.
50 * @param[in] input Source tensor. DataType supported: QASYMM8/F16/F32.
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.
57 void configure(const ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info);
59 // Inherited methods overridden:
60 void run(const Window &window, cl::CommandQueue &queue) override;
61 BorderSize border_size() const override;
64 BorderSize _border_size;
65 const ICLTensor *_input;
67 const ICLTensor *_weights;
68 const ICLTensor *_biases;
69 unsigned int _conv_stride_x;
70 unsigned int _conv_stride_y;
71 unsigned int _conv_pad_left;
72 unsigned int _conv_pad_top;
74 } // namespace arm_compute
75 #endif /*__ARM_COMPUTE_CLDEPTHWISECONVOLUTIONKERNEL3x3_H__ */