Compute Library
 19.08
CLFFTConvolutionLayer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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_CLFFTCONVOLUTIONLAYER_H__
25 #define __ARM_COMPUTE_CLFFTCONVOLUTIONLAYER_H__
26 
28 
29 #include "arm_compute/core/Types.h"
40 
41 namespace arm_compute
42 {
43 // Forward declarations
44 class ICLTensor;
45 
60 {
61 public:
63  CLFFTConvolutionLayer(std::shared_ptr<IMemoryManager> memory_manager = nullptr);
86  void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info,
104  static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info,
106 
107  // Inherited methods overridden:
108  void run() override;
109  void prepare() override;
110 
111 private:
112  CLMemoryGroup _memory_group;
113  CLReverse _flip_weights_func;
114  CLPermute _permute_input_func;
115  CLPermute _permute_output_func;
116  CLPermute _permute_weights_func;
117  CLPermute _permute_bias_func;
118  CLPadLayer _pad_input_func;
119  CLPadLayer _pad_weights_func;
120  CLFFT2D _transform_input_func;
121  std::unique_ptr<CLFFT2D> _transform_weights_func;
122  CLFFT2D _itransform_output_func;
124  CLReductionOperation _reduce_func;
125  CLSlice _extract_output_func;
126  CLArithmeticAddition _bias_add_func;
127  CLActivationLayer _activation_layer_func;
128 
129  CLTensor _permuted_input;
130  CLTensor _permuted_weights;
131  CLTensor _permuted_bias;
132  CLTensor _permuted_output;
133  CLTensor _padded_input;
134  CLTensor _padded_weights;
135  CLTensor _flip_axis;
136  CLTensor _flipped_weights;
137  CLTensor _transformed_input;
138  CLTensor _transformed_weights;
139  CLTensor _input_weights_product;
140  CLTensor _output_product;
141  CLTensor _output_reduced;
142  CLTensor _itransformed_output;
143  CLTensor _reshaped_output;
144  CLTensor _bias_output;
145 
146  const ICLTensor *_original_weights;
147  const ICLTensor *_original_bias;
148  bool _is_activationlayer_enabled;
149  bool _needs_permute;
150  bool _has_bias;
151  bool _is_prepared;
152 };
153 } // namespace arm_compute
154 #endif /* __ARM_COMPUTE_CLFFTCONVOLUTIONLAYER_H__ */
Basic function to execute FFT-based convolution on OpenCL.
Basic function to run CLReverseKernel.
Definition: CLReverse.h:34
Base class for all functions.
Definition: IFunction.h:30
void run() override
Run the kernels contained in the function.
Basic function to pad a tensor.
Definition: CLPadLayer.h:47
Basic function to run CLComplexPixelWiseMultiplicationKernel.
Basic function to run CLSaturatedArithmeticOperationKernel for addition.
Store the tensor's metadata.
Definition: ITensorInfo.h:40
Basic function to run CLActivationLayerKernel.
void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Set the input and output tensors.
Status class.
Definition: Error.h:52
Activation Layer Information class.
Definition: Types.h:1517
Basic function to perform tensor slicing.
Definition: CLSlice.h:35
Copyright (c) 2017-2018 ARM Limited.
Basic function to execute an CLPermuteKernel.
Definition: CLPermute.h:37
Padding and stride information class.
Definition: Types.h:676
Basic function to execute two dimensional FFT.
Definition: CLFFT2D.h:44
Interface for OpenCL tensor.
Definition: ICLTensor.h:42
CLFFTConvolutionLayer & operator=(const CLFFTConvolutionLayer &)=delete
Prevent instances of this class from being copied (As this class contains pointers)
Perform reduction operation.
CLFFTConvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo())
Static function to check if given info will lead to a valid configuration of CLFFTConvolutionLayer.
void prepare() override
Prepare the function for executing.
Basic implementation of the OpenCL tensor interface.
Definition: CLTensor.h:40