ONE - On-device Neural Engine
|
#include <CLDirectTransposeConvLayer.h>
Public Member Functions | |
CLDirectTransposeConvLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr) | |
CLDirectTransposeConvLayer (const CLDirectTransposeConvLayer &)=delete | |
CLDirectTransposeConvLayer (CLDirectTransposeConvLayer &&)=default | |
CLDirectTransposeConvLayer & | operator= (const CLDirectTransposeConvLayer &)=delete |
CLDirectTransposeConvLayer & | operator= (CLDirectTransposeConvLayer &&)=default |
void | configure (ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &info, unsigned int invalid_right, unsigned int invalid_bottom, const WeightsInfo &weights_info=WeightsInfo()) |
void | configure (const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &info, unsigned int invalid_right, unsigned int invalid_bottom, const WeightsInfo &weights_info=WeightsInfo()) |
void | run () override |
void | prepare () override |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, ITensorInfo *output, const PadStrideInfo &info, unsigned int invalid_right, unsigned int invalid_bottom, const WeightsInfo &weights_info=WeightsInfo()) |
Function to run the deconvolution layer.
Deconvolution Layer is the backward pass of Convolution Layer. First we transform the input depending on the stride and pad info and then perform a 1x1 convolution pass. Input stride defines how many zeroes we should put between each element of the input and pad is the amount of padding.
The relation between input to output is as follows:
where: width_input is the size of the first input dimension. height_input is the size of the second input dimension. width_output is the size of the first output dimension. height_output is the size of the second output dimension. kernel_x and kernel_y are the convolution sizes in x and y. stride_x and stride_y is the input stride of the first and second dimension.
The weights used by Deconvolution are supposed to be the same as the ones used for Convolution. Therefore, it will be necessary to use the weights in the reverse order to perform an actual convolution. This is achieved by using CLReverse.
This function calls the following OpenCL kernels/functions:
And the following CPP kernels:
Definition at line 94 of file CLDirectTransposeConvLayer.h.
arm_compute::CLDirectTransposeConvLayer::CLDirectTransposeConvLayer | ( | std::shared_ptr< IMemoryManager > | memory_manager = nullptr | ) |
Constructor
Definition at line 58 of file CLDirectTransposeConvLayer.cpp.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Default move constructor
void arm_compute::CLDirectTransposeConvLayer::configure | ( | const CLCompileContext & | compile_context, |
ICLTensor * | input, | ||
ICLTensor * | weights, | ||
const ICLTensor * | bias, | ||
ICLTensor * | output, | ||
const PadStrideInfo & | info, | ||
unsigned int | invalid_right, | ||
unsigned int | invalid_bottom, | ||
const WeightsInfo & | weights_info = WeightsInfo() |
||
) |
Set the input, weights, biases and output tensors.
[in] | compile_context | The compile context to be used. |
[in,out] | input | Input tensor. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. |
[in] | weights | The 4d weights with dimensions [width, height, IFM, OFM]. Data type supported: Same as input . |
[in] | bias | (Optional) The biases have one dimension. Data type supported: Should match input data type, except for input of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type |
[out] | output | Output tensor. The output has the same number of dimensions as the input . |
[in] | info | Contains padding and policies to be used in the deconvolution, this is decribed in PadStrideInfo. |
[in] | invalid_right | The number of zeros added to right edge of the output. |
[in] | invalid_bottom | The number of zeros added to bottom edge of the output. |
[in] | weights_info | (Optional) Weights information needed for CLConvolutionLayer, specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. |
Definition at line 144 of file CLDirectTransposeConvLayer.cpp.
References arm_compute::misc::shape_calculator::compute_transposeconv_output_shape(), arm_compute::misc::shape_calculator::compute_transposeconv_upsampled_shape(), info, output_shape, arm_compute::transposeconv_output_dimensions(), and validate().
void arm_compute::CLDirectTransposeConvLayer::configure | ( | ICLTensor * | input, |
ICLTensor * | weights, | ||
const ICLTensor * | bias, | ||
ICLTensor * | output, | ||
const PadStrideInfo & | info, | ||
unsigned int | invalid_right, | ||
unsigned int | invalid_bottom, | ||
const WeightsInfo & | weights_info = WeightsInfo() |
||
) |
Set the input, weights, biases and output tensors.
[in,out] | input | Input tensor. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. |
[in] | weights | The 4d weights with dimensions [width, height, IFM, OFM]. Data type supported: Same as input . |
[in] | bias | (Optional) The biases have one dimension. Data type supported: Should match input data type, except for input of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type |
[out] | output | Output tensor. The output has the same number of dimensions as the input . |
[in] | info | Contains padding and policies to be used in the deconvolution, this is decribed in PadStrideInfo. |
[in] | invalid_right | The number of zeros added to right edge of the output. |
[in] | invalid_bottom | The number of zeros added to bottom edge of the output. |
[in] | weights_info | (Optional) Weights information needed for CLConvolutionLayer, specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. |
Definition at line 134 of file CLDirectTransposeConvLayer.cpp.
References configure(), and info.
Referenced by configure().
|
default |
Default move assignment operator
References validate().
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
override |
Definition at line 241 of file CLDirectTransposeConvLayer.cpp.
Referenced by run().
|
override |
Definition at line 231 of file CLDirectTransposeConvLayer.cpp.
References prepare().
Referenced by package.infer.session::inference().
|
static |
Static function to check if given info will lead to a valid configuration of CLDirectTransposeConvLayer
[in] | input | Input tensor info. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: QASYMM8_SIGNED/QASYMM8/F16/F32. |
[in] | weights | The 4d weights info with dimensions [width, height, IFM, OFM]. Data type supported: Same as input . |
[in] | bias | (Optional) The biases have one dimension. Data type supported: Should match input data type, except for input of QASYMM8 and QASYMM8_SIGNED type where biases should be of S32 type |
[in] | output | Output tensor info. The output has the same number of dimensions as the input . |
[in] | info | Contains padding and policies to be used in the deconvolution, this is decribed in PadStrideInfo. |
[in] | invalid_right | The number of zeros added to right edge of the output. |
[in] | invalid_bottom | The number of zeros added to bottom edge of the output. |
[in] | weights_info | (Optional) Weights information needed for CLConvolutionLayer, specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel. |
Definition at line 66 of file CLDirectTransposeConvLayer.cpp.
References arm_compute::misc::shape_calculator::compute_transposeconv_output_shape(), arm_compute::misc::shape_calculator::compute_transposeconv_upsampled_shape(), info, output_shape, and arm_compute::transposeconv_output_dimensions().
Referenced by configure(), operator=(), and arm_compute::CLTransposeConvLayer::validate().