23.11
|
Go to the documentation of this file.
46 : _memory_group(std::move(memory_manager)),
51 _original_weights(nullptr),
108 unsigned int deconv_pad_x = 0;
109 unsigned int deconv_pad_y = 0;
110 const unsigned int stride_x =
info.stride().first;
111 const unsigned int stride_y =
info.stride().second;
113 out_dims, deconv_pad_x, deconv_pad_y);
115 ->set_is_resizable(
true)
117 .set_tensor_shape(scale_out_shape)
149 const unsigned int pad_left =
info.pad_left();
150 const unsigned int pad_right =
info.pad_right();
151 const unsigned int pad_top =
info.pad_top();
152 const unsigned int pad_bottom =
info.pad_bottom();
153 const unsigned int stride_x =
info.stride().first;
154 const unsigned int stride_y =
info.stride().second;
161 _original_weights = weights;
164 _flip_weights.
configure(compile_context, weights, &_weights_flipped, &_flip_axis,
false);
182 _memory_group.
manage(&_scaled_output);
185 unsigned int deconv_pad_x = 0;
186 unsigned int deconv_pad_y = 0;
188 *
input->info(), *weights->
info(), stride_x, stride_y, out_dims, deconv_pad_x, deconv_pad_y);
190 unsigned int deconv_pad_left = pad_right > pad_left ? pad_right - pad_left : 0;
191 unsigned int deconv_pad_right = pad_left > pad_right ? pad_left - pad_right : 0;
192 deconv_pad_x -= deconv_pad_left + deconv_pad_right;
194 deconv_pad_left += deconv_pad_x / 2;
195 deconv_pad_right += deconv_pad_x / 2;
197 unsigned int deconv_pad_top = pad_bottom > pad_top ? pad_bottom - pad_top : 0;
198 unsigned int deconv_pad_bottom = pad_top > pad_bottom ? pad_top - pad_bottom : 0;
199 deconv_pad_y -= deconv_pad_top + deconv_pad_bottom;
201 deconv_pad_top += deconv_pad_y / 2;
202 deconv_pad_bottom += deconv_pad_y / 2;
204 TensorInfo scale_out_info(scale_out_shape, 1,
input->info()->data_type(),
input->info()->quantization_info());
209 const PadStrideInfo upsample_info(stride_x, stride_y, deconv_pad_left, deconv_pad_right, deconv_pad_top,
211 _scale_f.
configure(compile_context,
input, &_scaled_output, upsample_info);
220 _flip_axis.
map(
true);
221 auto axis_data =
reinterpret_cast<uint32_t *
>(_flip_axis.
buffer());
260 if (!_weights_flipped.
is_used())
@ QSYMM8_PER_CHANNEL
quantized, symmetric per channel fixed-point 8-bit number
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
void unmap()
Enqueue an unmap operation of the allocated and mapped buffer.
Convolution Layer Weights Information class.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
DataLayout
[DataLayout enum definition]
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.
@ NHWC
Num samples, height, width, channels.
void configure(ICLTensor *input, ICLTensor *output, const PadStrideInfo &info)
Initialize the function's source, destination, interpolation type and border_mode.
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
void init(const TensorInfo &input, size_t alignment=0)
Initialize a tensor based on the passed TensorInfo.
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.
CLDirectDeconvolutionLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Constructor.
Interface for OpenCL tensor.
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.
void map(bool blocking=true)
Enqueue a map operation of the allocated buffer.
void run() override
Run the kernels contained in the function.
void prepare() override
Prepare the function for executing.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context.
constexpr auto data_layout
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
void run() override
Run the kernels contained in the function.
uint8_t * buffer() const override
Interface to be implemented by the child class to return a pointer to CPU memory.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
@ U32
unsigned 32-bit number
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.
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...
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
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...
void mark_as_unused() const
Marks a tensor as unused.
ITensorInfo & set_data_layout(const DataLayout &data_layout) override
Set the data layout of the tensor.
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
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.
CLTensorAllocator * allocator()
Return a pointer to the tensor's allocator.
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Store the tensor's metadata.
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 prepare() override
Prepare the function for executing.
bool is_used() const
Flags if the tensor is used or not.
void configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *axis, bool use_inverted_axis)
Initialize the function.
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.
Memory group resources scope handling class.
Copyright (c) 2017-2023 Arm Limited.
@ F16
16-bit floating-point number
@ S32
signed 32-bit number
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
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.
Store the tensor's metadata.
@ F32
32-bit floating-point number
void run() override
Run the kernels contained in the function.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
#define ARM_COMPUTE_LOG_PARAMS(...)
void run() override final
Run the kernels contained in the function.