Compute Library
 21.02
CLDirectDeconvolutionLayer Class Reference

Function to run the deconvolution layer. More...

#include <CLDirectDeconvolutionLayer.h>

Collaboration diagram for CLDirectDeconvolutionLayer:
[legend]

Public Member Functions

 CLDirectDeconvolutionLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr)
 Constructor. More...
 
 CLDirectDeconvolutionLayer (const CLDirectDeconvolutionLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 CLDirectDeconvolutionLayer (CLDirectDeconvolutionLayer &&)=default
 Default move constructor. More...
 
CLDirectDeconvolutionLayeroperator= (const CLDirectDeconvolutionLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
CLDirectDeconvolutionLayeroperator= (CLDirectDeconvolutionLayer &&)=default
 Default move assignment operator. More...
 
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. More...
 
void configure (const CLCompileContext &compile_context, 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. 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 *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 CLDirectDeconvolutionLayer. More...
 

Detailed Description

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:

\[ width\_output = (width\_input - 1) \cdot stride\_x - 2 \cdot padding\_x + kernel\_x \]

\[ height\_output = (height\_input - 1) \cdot stride\_y - 2 \cdot padding\_y + kernel\_y \]

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:

  1. CLDeconvolutionLayerUpsample
  2. CLConvolutionLayer

And the following CPP kernels:

  1. CLReverse

Definition at line 75 of file CLDirectDeconvolutionLayer.h.

Constructor & Destructor Documentation

◆ CLDirectDeconvolutionLayer() [1/3]

CLDirectDeconvolutionLayer ( std::shared_ptr< IMemoryManager memory_manager = nullptr)

Constructor.

Definition at line 45 of file CLDirectDeconvolutionLayer.cpp.

46  : _memory_group(std::move(memory_manager)),
47  _scale_f(),
48  _conv_f(),
49  _flip_weights(),
50  _scaled_output(),
51  _original_weights(nullptr),
52  _weights_flipped(),
53  _flip_axis(),
54  _is_prepared(false)
55 {
56 }

◆ CLDirectDeconvolutionLayer() [2/3]

Prevent instances of this class from being copied (As this class contains pointers)

◆ CLDirectDeconvolutionLayer() [3/3]

Default move constructor.

Member Function Documentation

◆ configure() [1/2]

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.

Parameters
[in,out]inputInput 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]weightsThe 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]outputOutput tensor. The output has the same number of dimensions as the input.
[in]infoContains padding and policies to be used in the deconvolution, this is decribed in PadStrideInfo.
[in]weights_info(Optional) Weights information needed for CLConvolutionLayer, specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel.

Definition at line 110 of file CLDirectDeconvolutionLayer.cpp.

References CLKernelLibrary::get().

112 {
113  configure(CLKernelLibrary::get().get_compile_context(), input, weights, bias, output, info, weights_info);
114 }
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
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.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ configure() [2/2]

void configure ( const CLCompileContext compile_context,
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.

Parameters
[in]compile_contextThe compile context to be used.
[in,out]inputInput 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]weightsThe 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]outputOutput tensor. The output has the same number of dimensions as the input.
[in]infoContains padding and policies to be used in the deconvolution, this is decribed in PadStrideInfo.
[in]weights_info(Optional) Weights information needed for CLConvolutionLayer, specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel.

Definition at line 116 of file CLDirectDeconvolutionLayer.cpp.

References CLTensorAllocator::allocate(), CLTensor::allocator(), ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), ICLTensor::buffer(), arm_compute::CEIL, ICloneable< T >::clone(), arm_compute::misc::shape_calculator::compute_deconvolution_output_shape(), arm_compute::misc::shape_calculator::compute_deconvolution_upsampled_shape(), CLReverse::configure(), CLDeconvolutionLayerUpsample::configure(), CLConvolutionLayer::configure(), arm_compute::test::validation::conv_info, arm_compute::test::validation::data_layout, ITensorInfo::data_layout(), ITensorInfo::data_type(), arm_compute::deconvolution_output_dimensions(), ITensorInfo::dimension(), arm_compute::FLOOR, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, ITensor::info(), arm_compute::test::validation::info, ITensorAllocator::init(), MemoryGroup::manage(), CLTensor::map(), arm_compute::NHWC, arm_compute::test::validation::output_shape, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), ITensorInfo::quantization_info(), WeightsInfo::retain_internal_weights(), TensorInfo::set_data_layout(), PadStrideInfo::stride(), arm_compute::U, arm_compute::U32, CLTensor::unmap(), CLDirectDeconvolutionLayer::validate(), and arm_compute::WIDTH.

118 {
119  ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output);
120 
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;
127 
128  const DataLayout data_layout = input->info()->data_layout();
129 
130  const size_t idx_w = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
131  const size_t idx_h = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
132 
133  _original_weights = weights;
134  _flip_axis.allocator()->init(TensorInfo(TensorShape(2U), 1, DataType::U32));
135  _weights_flipped.allocator()->init(weights->info()->clone()->set_data_layout(data_layout));
136  _flip_weights.configure(compile_context, weights, &_weights_flipped, &_flip_axis);
137 
138  auto out_dims = deconvolution_output_dimensions(input->info()->dimension(idx_w), input->info()->dimension(idx_h), weights->info()->dimension(idx_w), weights->info()->dimension(idx_h), info);
139 
140  const TensorShape output_shape = compute_deconvolution_output_shape(out_dims, *input->info(), *weights->info());
141 
142  // Output auto initialization if not yet initialized
143  auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape).set_data_layout(data_layout));
144 
145  // Perform validation step
146  ARM_COMPUTE_ERROR_THROW_ON(CLDirectDeconvolutionLayer::validate(input->info(), weights->info(), bias == nullptr ? nullptr : bias->info(), output->info(), info));
147 
148  _is_prepared = weights_info.retain_internal_weights();
149 
150  _memory_group.manage(&_scaled_output);
151 
152  // Find the upsampled dimensions and the padding needed for the convolution with stride 1 in order to match output shape
153  unsigned int deconv_pad_x = 0;
154  unsigned int deconv_pad_y = 0;
155  const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input->info(), *weights->info(), stride_x, stride_y, out_dims, deconv_pad_x, deconv_pad_y);
156 
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;
160  ARM_COMPUTE_ERROR_ON((deconv_pad_x % 2) != 0);
161  deconv_pad_left += deconv_pad_x / 2;
162  deconv_pad_right += deconv_pad_x / 2;
163 
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;
167  ARM_COMPUTE_ERROR_ON((deconv_pad_y % 2) != 0);
168  deconv_pad_top += deconv_pad_y / 2;
169  deconv_pad_bottom += deconv_pad_y / 2;
170 
171  TensorInfo scale_out_info(scale_out_shape, 1, input->info()->data_type(), input->info()->quantization_info());
172  scale_out_info.set_data_layout(data_layout);
173  _scaled_output.allocator()->init(scale_out_info);
174 
175  // configure scale function
176  const PadStrideInfo upsample_info(stride_x, stride_y, deconv_pad_left, deconv_pad_right, deconv_pad_top, deconv_pad_bottom, DimensionRoundingType::FLOOR);
177  _scale_f.configure(compile_context, input, &_scaled_output, upsample_info);
178 
179  // Setup the function to convolve the upscaled output
180  const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL);
181  _conv_f.configure(compile_context, &_scaled_output, &_weights_flipped, bias, output, conv_info, weights_info);
182  _scaled_output.allocator()->allocate();
183 
184  // Setup flip axis data
185  _flip_axis.allocator()->allocate();
186  _flip_axis.map(true);
187  auto axis_data = reinterpret_cast<uint32_t *>(_flip_axis.buffer());
188  if(weights->info()->data_layout() == DataLayout::NHWC)
189  {
190  axis_data[0] = 1;
191  axis_data[1] = 2;
192  }
193  else
194  {
195  axis_data[0] = 0;
196  axis_data[1] = 1;
197  }
198  _flip_axis.unmap();
199 }
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 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.
void configure(ICLTensor *input, ICLTensor *output, const PadStrideInfo &info)
Initialize the function&#39;s source, destination, interpolation type and border_mode.
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&#39;s output tensor.
Definition: Utils.cpp:399
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
const DataLayout data_layout
Definition: Im2Col.cpp:151
CLTensorAllocator * allocator()
Return a pointer to the tensor&#39;s allocator.
Definition: CLTensor.cpp:61
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Definition: Error.h:455
void init(const TensorInfo &input, size_t alignment=0)
Initialize a tensor based on the passed TensorInfo.
void map(bool blocking=true)
Enqueue a map operation of the allocated buffer.
Definition: CLTensor.cpp:66
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.
uint8_t * buffer() const override
Interface to be implemented by the child class to return a pointer to CPU memory. ...
Definition: ICLTensor.cpp:53
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
Definition: MemoryGroup.h:79
1 channel, 1 U32 per channel
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...
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.
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Num samples, height, width, channels.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
Definition: Helpers.inl:193
void unmap()
Enqueue an unmap operation of the allocated and mapped buffer.
Definition: CLTensor.cpp:71
DataLayout
[DataLayout enum definition]
Definition: Types.h:120
void configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *axis)
Initialize the function.
Definition: CLReverse.cpp:31

◆ operator=() [1/2]

CLDirectDeconvolutionLayer& operator= ( const CLDirectDeconvolutionLayer )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ operator=() [2/2]

Default move assignment operator.

◆ prepare()

void prepare ( )
overridevirtual

Prepare the function for executing.

Any one off pre-processing step required by the function is handled here

Note
Prepare stage might not need all the function's buffers' backing memory to be available in order to execute

Reimplemented from IFunction.

Definition at line 211 of file CLDirectDeconvolutionLayer.cpp.

References CLTensorAllocator::allocate(), CLTensor::allocator(), ARM_COMPUTE_ERROR_ON, CLTensorAllocator::free(), ITensor::is_used(), ITensor::mark_as_unused(), CLConvolutionLayer::prepare(), and ICLSimpleFunction::run().

Referenced by CLDirectDeconvolutionLayer::run().

212 {
213  if(!_is_prepared)
214  {
215  ARM_COMPUTE_ERROR_ON(!_original_weights->is_used());
216 
217  // Run weights flipping and mark original weights tensor as unused
218  _weights_flipped.allocator()->allocate();
219  _flip_weights.run();
220  _original_weights->mark_as_unused();
221 
222  // Prepare convolution
223  _conv_f.prepare();
224 
225  // Free flipped weights
226  if(!_weights_flipped.is_used())
227  {
228  _weights_flipped.allocator()->free();
229  }
230 
231  _is_prepared = true;
232  }
233 }
bool is_used() const
Flags if the tensor is used or not.
Definition: ITensor.cpp:163
void prepare() override
Prepare the function for executing.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
CLTensorAllocator * allocator()
Return a pointer to the tensor&#39;s allocator.
Definition: CLTensor.cpp:61
void mark_as_unused() const
Marks a tensor as unused.
Definition: ITensor.cpp:168
void run() override final
Run the kernels contained in the function.
void allocate() override
Allocate size specified by TensorInfo of OpenCL memory.
void free() override
Free allocated OpenCL memory.

◆ run()

void run ( )
overridevirtual

Run the kernels contained in the function.

For Neon kernels:

  • Multi-threading is used for the kernels which are parallelisable.
  • By default std::thread::hardware_concurrency() threads are used.
Note
CPPScheduler::set_num_threads() can be used to manually set the number of threads

For OpenCL kernels:

  • All the kernels are enqueued on the queue associated with CLScheduler.
  • The queue is then flushed.
Note
The function will not block until the kernels are executed. It is the user's responsibility to wait.
Will call prepare() on first run if hasn't been done

Implements IFunction.

Definition at line 201 of file CLDirectDeconvolutionLayer.cpp.

References CLDirectDeconvolutionLayer::prepare(), CLDeconvolutionLayerUpsample::run(), and CLConvolutionLayer::run().

202 {
203  prepare();
204 
205  MemoryGroupResourceScope scope_mg(_memory_group);
206 
207  _scale_f.run();
208  _conv_f.run();
209 }
void run() override
Run the kernels contained in the function.
void run() override
Run the kernels contained in the function.
void prepare() override
Prepare the function for executing.

◆ validate()

Status validate ( const ITensorInfo input,
const ITensorInfo weights,
const ITensorInfo bias,
ITensorInfo output,
const PadStrideInfo info,
const WeightsInfo weights_info = WeightsInfo() 
)
static

Static function to check if given info will lead to a valid configuration of CLDirectDeconvolutionLayer.

Parameters
[in]inputInput 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]weightsThe 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]outputOutput tensor info. The output has the same number of dimensions as the input.
[in]infoContains padding and policies to be used in the deconvolution, this is decribed in PadStrideInfo.
[in]weights_info(Optional) Weights information needed for CLConvolutionLayer, specifies if the weights tensor has been reshaped with CLWeightsReshapeKernel.
Returns
a status

Definition at line 58 of file CLDirectDeconvolutionLayer.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_RETURN_ERROR_ON_MSG, ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_RETURN_ON_ERROR, arm_compute::CEIL, arm_compute::CHANNEL, ICloneable< T >::clone(), arm_compute::misc::shape_calculator::compute_deconvolution_output_shape(), arm_compute::misc::shape_calculator::compute_deconvolution_upsampled_shape(), arm_compute::test::validation::conv_info, arm_compute::test::validation::data_layout, ITensorInfo::data_layout(), ITensorInfo::data_type(), arm_compute::deconvolution_output_dimensions(), ITensorInfo::dimension(), arm_compute::F16, arm_compute::F32, arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, arm_compute::test::validation::info, arm_compute::is_data_type_quantized_asymmetric(), arm_compute::test::validation::output_shape, arm_compute::QASYMM8, arm_compute::QASYMM8_SIGNED, arm_compute::S32, PadStrideInfo::stride(), CLDeconvolutionLayerUpsample::validate(), CLConvolutionLayer::validate(), and arm_compute::WIDTH.

Referenced by CLDirectDeconvolutionLayer::configure(), and CLDeconvolutionLayer::validate().

60 {
64  const DataLayout data_layout = input->data_layout();
65 
66  const size_t idx_w = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
67  const size_t idx_h = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
68  const size_t idx_c = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL);
69 
70  ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(idx_w) != weights->dimension(idx_h));
71  ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(idx_w) < 1);
72 
73  auto out_dims = deconvolution_output_dimensions(input->dimension(idx_w), input->dimension(idx_h), weights->dimension(idx_w), weights->dimension(idx_h), info);
74 
75  const TensorShape output_shape = compute_deconvolution_output_shape(out_dims, *input, *weights);
76 
78 
79  if(bias != nullptr)
80  {
82  {
84  }
85  else
86  {
88  }
90  }
91 
92  ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(idx_w) != output_shape[idx_w], "Output's width is invalid.");
93  ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(idx_h) != output_shape[idx_h], "Output's height is invalid.");
94  ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(idx_c) != output_shape[idx_c], "Output's depth is invalid.");
95 
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;
100  const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input, *weights, stride_x, stride_y, out_dims, deconv_pad_x, deconv_pad_y);
101  TensorInfo scale_out_info(input->clone()->set_is_resizable(true).reset_padding().set_tensor_shape(scale_out_shape).set_data_layout(data_layout));
102  const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL);
103 
105  ARM_COMPUTE_RETURN_ON_ERROR(CLConvolutionLayer::validate(&scale_out_info, weights, bias, output, conv_info, weights_info));
106 
107  return Status{};
108 }
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
Definition: Validate.h:494
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&#39;s output tensor.
Definition: Utils.cpp:399
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
1 channel, 1 F32 per channel
const DataLayout data_layout
Definition: Im2Col.cpp:151
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.
Definition: Error.h:296
1 channel, 1 F16 per channel
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:163
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.
1 channel, 1 S32 per channel
quantized, asymmetric fixed-point 8-bit number unsigned
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.
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
Definition: Utils.h:1190
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
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_MISMATCHING_DATA_TYPES(...)
Definition: Validate.h:545
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:792
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Definition: Error.h:244
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.
Definition: Helpers.inl:193
DataLayout
[DataLayout enum definition]
Definition: Types.h:120

The documentation for this class was generated from the following files: