46 : _memory_group(
std::move(memory_manager)),
51 _original_weights(nullptr),
96 unsigned int deconv_pad_x = 0;
97 unsigned int deconv_pad_y = 0;
98 const unsigned int stride_x = info.
stride().first;
99 const unsigned int stride_y = info.
stride().second;
101 TensorInfo scale_out_info(input->
clone()->set_is_resizable(
true).reset_padding().set_tensor_shape(scale_out_shape).set_data_layout(data_layout));
121 const unsigned int pad_left = info.
pad_left();
122 const unsigned int pad_right = info.
pad_right();
123 const unsigned int pad_top = info.
pad_top();
124 const unsigned int pad_bottom = info.
pad_bottom();
125 const unsigned int stride_x = info.
stride().first;
126 const unsigned int stride_y = info.
stride().second;
133 _original_weights = weights;
136 _flip_weights.
configure(compile_context, weights, &_weights_flipped, &_flip_axis);
150 _memory_group.
manage(&_scaled_output);
153 unsigned int deconv_pad_x = 0;
154 unsigned int deconv_pad_y = 0;
157 unsigned int deconv_pad_left = pad_right > pad_left ? pad_right - pad_left : 0;
158 unsigned int deconv_pad_right = pad_left > pad_right ? pad_left - pad_right : 0;
159 deconv_pad_x -= deconv_pad_left + deconv_pad_right;
161 deconv_pad_left += deconv_pad_x / 2;
162 deconv_pad_right += deconv_pad_x / 2;
164 unsigned int deconv_pad_top = pad_bottom > pad_top ? pad_bottom - pad_top : 0;
165 unsigned int deconv_pad_bottom = pad_top > pad_bottom ? pad_top - pad_bottom : 0;
166 deconv_pad_y -= deconv_pad_top + deconv_pad_bottom;
168 deconv_pad_top += deconv_pad_y / 2;
169 deconv_pad_bottom += deconv_pad_y / 2;
177 _scale_f.
configure(compile_context, input, &_scaled_output, upsample_info);
181 _conv_f.
configure(compile_context, &_scaled_output, &_weights_flipped, bias, output, conv_info, weights_info);
186 _flip_axis.
map(
true);
187 auto axis_data =
reinterpret_cast<uint32_t *
>(_flip_axis.
buffer());
226 if(!_weights_flipped.
is_used())
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, ITensorInfo *output, const PadStrideInfo &info, const WeightsInfo &weights_info=WeightsInfo())
Static function to check if given info will lead to a valid configuration of CLDirectDeconvolutionLay...
void run() override
Run the kernels contained in the function.
void configure(ICLTensor *input, const ICLTensor *weights, const ICLTensor *biases, ICLTensor *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info=WeightsInfo(), const Size2D &dilation=Size2D(1U, 1U), const ActivationLayerInfo &act_info=ActivationLayerInfo(), bool enable_fast_math=false, unsigned int num_groups=1)
Set the input and output tensors.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
void configure(ICLTensor *input, ICLTensor *output, const PadStrideInfo &info)
Initialize the function's source, destination, interpolation type and border_mode.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
std::pair< unsigned int, unsigned int > deconvolution_output_dimensions(unsigned int in_width, unsigned int in_height, unsigned int kernel_width, unsigned int kernel_height, const PadStrideInfo &pad_stride_info)
Returns expected width and height of the deconvolution's output tensor.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
bool is_used() const
Flags if the tensor is used or not.
void prepare() override
Prepare the function for executing.
1 channel, 1 F32 per channel
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
const DataLayout data_layout
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Store the tensor's metadata.
CLTensorAllocator * allocator()
Return a pointer to the tensor's allocator.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
unsigned int pad_top() const
Get the top padding.
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info=WeightsInfo(), const Size2D &dilation=Size2D(1U, 1U), const ActivationLayerInfo &act_info=ActivationLayerInfo(), bool enable_fast_math=false, unsigned int num_groups=1)
Static function to check if given info will lead to a valid configuration of CLConvolutionLayer.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
void init(const TensorInfo &input, size_t alignment=0)
Initialize a tensor based on the passed TensorInfo.
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
CLDirectDeconvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Constructor.
void map(bool blocking=true)
Enqueue a map operation of the allocated buffer.
Convolution Layer Weights Information class.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
TensorShape compute_deconvolution_output_shape(const std::pair< unsigned int, unsigned int > &out_dims, const ITensorInfo &input, const ITensorInfo &weights)
Calculate the output shape of the deconvolution layer.
void mark_as_unused() const
Marks a tensor as unused.
uint8_t * buffer() const override
Interface to be implemented by the child class to return a pointer to CPU memory. ...
1 channel, 1 S32 per channel
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
void run() override
Run the kernels contained in the function.
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
ITensorInfo & set_data_layout(const DataLayout &data_layout) override
Set the data layout of the tensor.
void run() override final
Run the kernels contained in the function.
1 channel, 1 U32 per channel
quantized, asymmetric fixed-point 8-bit number unsigned
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
TensorShape compute_deconvolution_upsampled_shape(const ITensorInfo &input, const ITensorInfo &weights, unsigned int sx, unsigned int sy, std::pair< unsigned int, unsigned int > &out_dims, uint32_t &padx, uint32_t &pady)
Calculate the upsampled output shape used for deconvolution.
unsigned int pad_right() const
Get the right padding.
Padding and stride information class.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
void run() override
Run the kernels contained in the function.
void configure(ICLTensor *input, ICLTensor *weights, const ICLTensor *bias, ICLTensor *output, const PadStrideInfo &info, const WeightsInfo &weights_info=WeightsInfo())
Set the input, weights, biases and output tensors.
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Memory group resources scope handling class.
Interface for OpenCL tensor.
void prepare() override
Prepare the function for executing.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &info)
Static function to check if given info will lead to a valid configuration of CLDeconvolutionLayerUpsa...
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Num samples, height, width, channels.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void free() override
Free allocated OpenCL memory.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Store the tensor's metadata.
quantized, asymmetric fixed-point 8-bit number signed
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
unsigned int pad_bottom() const
Get the bottom padding.
unsigned int pad_left() const
Get the left padding.
void unmap()
Enqueue an unmap operation of the allocated and mapped buffer.
DataLayout
[DataLayout enum definition]
bool retain_internal_weights() const
void configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *axis)
Initialize the function.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.