21.02
|
Basic function to execute FFT-based convolution on OpenCL. More...
#include <CLFFTConvolutionLayer.h>
Public Member Functions | |
CLFFTConvolutionLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr) | |
Default constructor. More... | |
CLFFTConvolutionLayer (const CLFFTConvolutionLayer &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLFFTConvolutionLayer (CLFFTConvolutionLayer &&)=default | |
Default move constructor. More... | |
CLFFTConvolutionLayer & | operator= (const CLFFTConvolutionLayer &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLFFTConvolutionLayer & | operator= (CLFFTConvolutionLayer &&)=default |
Default move assignment operator. More... | |
void | configure (ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo(), bool enable_fast_math=false) |
Set the input and output tensors. More... | |
void | configure (const CLCompileContext &compile_context, ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo(), bool enable_fast_math=false) |
Set the input and output tensors. More... | |
void | run () override |
Run the kernels contained in the function. More... | |
void | prepare () override |
Prepare the function for executing. More... | |
Public Member Functions inherited from IFunction | |
virtual | ~IFunction ()=default |
Destructor. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info=ActivationLayerInfo(), bool enable_fast_math=false) |
Static function to check if given info will lead to a valid configuration of CLFFTConvolutionLayer. More... | |
Basic function to execute FFT-based convolution on OpenCL.
This function calls the following OpenCL functions/kernels:
Definition at line 59 of file CLFFTConvolutionLayer.h.
CLFFTConvolutionLayer | ( | std::shared_ptr< IMemoryManager > | memory_manager = nullptr | ) |
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Default move constructor.
void configure | ( | ICLTensor * | input, |
const ICLTensor * | weights, | ||
const ICLTensor * | biases, | ||
ICLTensor * | output, | ||
const PadStrideInfo & | conv_info, | ||
const ActivationLayerInfo & | act_info = ActivationLayerInfo() , |
||
bool | enable_fast_math = false |
||
) |
Set the input and output tensors.
[in] | input | Source tensor. 3 lower dimensions represent a single input [width, height, IFM], while every optional dimension from 4 and above represent a batch of inputs. Data types supported: F16/F32. |
[in] | weights | Weights tensor. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported:Same as input . |
[in] | biases | Biases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM].Data type supported: Same as input |
[out] | output | Destination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs. Data types supported: Same as input . |
[in] | conv_info | Contains padding and stride information described in PadStrideInfo. |
[in] | act_info | (Optional) Activation layer information in case of a fused activation. |
[in] | enable_fast_math | (Optional) Enable fast math computation. In case this flag were set, the function could dispatch the fastest implementation available which may introduce a drop of accuracy as well. Default is false |
Definition at line 105 of file CLFFTConvolutionLayer.cpp.
References CLKernelLibrary::get().
void configure | ( | const CLCompileContext & | compile_context, |
ICLTensor * | input, | ||
const ICLTensor * | weights, | ||
const ICLTensor * | biases, | ||
ICLTensor * | output, | ||
const PadStrideInfo & | conv_info, | ||
const ActivationLayerInfo & | act_info = ActivationLayerInfo() , |
||
bool | enable_fast_math = false |
||
) |
Set the input and output tensors.
[in] | compile_context | The compile context to be used. |
[in] | input | Source tensor. 3 lower dimensions represent a single input [width, height, IFM], while every optional dimension from 4 and above represent a batch of inputs. Data types supported: F16/F32. |
[in] | weights | Weights tensor. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported:Same as input . |
[in] | biases | Biases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM].Data type supported: Same as input |
[out] | output | Destination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs. Data types supported: Same as input . |
[in] | conv_info | Contains padding and stride information described in PadStrideInfo. |
[in] | act_info | (Optional) Activation layer information in case of a fused activation. |
[in] | enable_fast_math | (Optional) Enable fast math computation. In case this flag were set, the function could dispatch the fastest implementation available which may introduce a drop of accuracy as well. Default is false |
Definition at line 111 of file CLFFTConvolutionLayer.cpp.
References CLTensorAllocator::allocate(), CLTensor::allocator(), ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_UNUSED, arm_compute::auto_init_if_empty(), ICLTensor::buffer(), ICloneable< T >::clone(), TensorInfo::clone(), CLReverse::configure(), CLPermute::configure(), CLFFT2D::configure(), CLActivationLayer::configure(), CLPadLayer::configure(), CLReductionOperation::configure(), CLArithmeticAddition::configure(), CLSlice::configure(), CLComplexPixelWiseMultiplication::configure(), arm_compute::test::validation::conv_info, ITensorInfo::data_layout(), FFT2DInfo::direction, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, arm_compute::test::validation::idx_height, arm_compute::test::validation::idx_width, ITensor::info(), CLTensor::info(), ITensorAllocator::init(), arm_compute::test::validation::input, arm_compute::Inverse, MemoryGroup::manage(), CLTensor::map(), arm_compute::NCHW, arm_compute::NHWC, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), TensorShape::remove_dimension(), TensorInfo::set_data_layout(), arm_compute::SUM, ITensorInfo::tensor_shape(), TensorInfo::tensor_shape(), arm_compute::U, arm_compute::U32, CLTensor::unmap(), CLFFTConvolutionLayer::validate(), arm_compute::WIDTH, arm_compute::WRAP, Dimensions< T >::x(), and Dimensions< T >::y().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Default move assignment operator.
|
overridevirtual |
Prepare the function for executing.
Any one off pre-processing step required by the function is handled here
Reimplemented from IFunction.
Definition at line 352 of file CLFFTConvolutionLayer.cpp.
References CLTensorAllocator::allocate(), CLTensor::allocator(), ARM_COMPUTE_ERROR_ON, CLTensorAllocator::free(), CLScheduler::get(), ITensor::is_used(), ITensor::mark_as_unused(), CLScheduler::queue(), ICLSimpleFunction::run(), CLPermute::run(), and CLPadLayer::run().
Referenced by CLFFTConvolutionLayer::run().
|
overridevirtual |
Run the kernels contained in the function.
For Neon kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 313 of file CLFFTConvolutionLayer.cpp.
References CLTensor::allocator(), CLTensor::cl_buffer(), CLTensorAllocator::import_memory(), CLFFTConvolutionLayer::prepare(), CLFFT2D::run(), CLPermute::run(), CLActivationLayer::run(), CLReductionOperation::run(), CLPadLayer::run(), CLArithmeticAddition::run(), CLSlice::run(), and CLComplexPixelWiseMultiplication::run().
|
static |
Static function to check if given info will lead to a valid configuration of CLFFTConvolutionLayer.
[in] | input | Source tensor. 3 lower dimensions represent a single input [width, height, IFM], while every optional dimension from 4 and above represent a batch of inputs. Data types supported: F16/F32. |
[in] | weights | Weights tensor. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported:Same as input . |
[in] | biases | Biases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM].Data type supported: Same as input |
[out] | output | Destination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs. Data types supported: Same as input . |
[in] | conv_info | Contains padding and stride information described in PadStrideInfo. |
[in] | act_info | (Optional) Activation layer information in case of a fused activation. |
[in] | enable_fast_math | (Optional) Enable fast math computation. In case this flag were set, the function could dispatch the fastest implementation available which may introduce a drop of accuracy as well. Default is false |
Definition at line 269 of file CLFFTConvolutionLayer.cpp.
References ARM_COMPUTE_RETURN_ERROR_ON, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_RETURN_ON_ERROR, ITensorInfo::data_layout(), ITensorInfo::data_type(), ActivationLayerInfo::enabled(), arm_compute::F16, arm_compute::F32, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, arm_compute::test::validation::idx_height, arm_compute::test::validation::idx_width, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), PadStrideInfo::stride(), ITensorInfo::tensor_shape(), ITensorInfo::total_size(), CLActivationLayer::validate(), arm_compute::WIDTH, and Dimensions< T >::x().
Referenced by CLFFTConvolutionLayer::configure(), CLConvolutionLayer::get_convolution_method(), and CLConvolutionLayer::validate().