Compute Library
 19.08
NEDeconvolutionLayer Class Reference

Function to run the deconvolution layer. More...

#include <NEDeconvolutionLayer.h>

Collaboration diagram for NEDeconvolutionLayer:
[legend]

Public Member Functions

 NEDeconvolutionLayer (std::shared_ptr< IMemoryManager > memory_manager=nullptr)
 Default constructor. More...
 
 NEDeconvolutionLayer (const NEDeconvolutionLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
NEDeconvolutionLayeroperator= (const NEDeconvolutionLayer &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
 NEDeconvolutionLayer (NEDeconvolutionLayer &&)=default
 Allow instances of this class to be moved. More...
 
NEDeconvolutionLayeroperator= (NEDeconvolutionLayer &&)=default
 Allow instances of this class to be moved. More...
 
virtual ~NEDeconvolutionLayer ()=default
 Default destructor. More...
 
void configure (ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, const PadStrideInfo &info)
 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, const ITensorInfo *output, const PadStrideInfo &info)
 Static function to check if given info will lead to a valid configuration of NEDeconvolutionLayer. 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 perfrom a 1x1 convolution pass. Input stride defines how many zeroes we should put between each element of the input, pad is the amount of padding and finaly a is a user specified value where a < stride - 1 that increases the padding top and right of the input image.

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 is the size of the first input dimension. height 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 the CPPFlipWeightsKernel.

This function calls the following NEON kernels/functions:

  1. CPPUpsample
  2. NEConvolutionLayer

Definition at line 73 of file NEDeconvolutionLayer.h.

Constructor & Destructor Documentation

◆ NEDeconvolutionLayer() [1/3]

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

Default constructor.

Definition at line 36 of file NEDeconvolutionLayer.cpp.

37  : _memory_group(std::move(memory_manager)),
38  _conv_f(),
39  _upsample_f(),
40  _flip_weights(),
41  _permute_input(),
42  _permute_weights(),
43  _permute_output(),
44  _scaled_output(),
45  _weights_flipped(),
46  _permuted_input(),
47  _permuted_weights(),
48  _permuted_output(),
49  _is_nchw(false),
50  _original_weights(nullptr),
51  _input(nullptr),
52  _info(),
53  _is_prepared(false)
54 {
55 }

◆ NEDeconvolutionLayer() [2/3]

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

◆ NEDeconvolutionLayer() [3/3]

Allow instances of this class to be moved.

◆ ~NEDeconvolutionLayer()

virtual ~NEDeconvolutionLayer ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ configure()

void configure ( ITensor input,
const ITensor weights,
const ITensor bias,
ITensor output,
const PadStrideInfo info 
)

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: F32/F16/QASYMM8.
[in]weightsThe 4d weights with dimensions [width, height, IFM, OFM]. Data type supported: Same as input.
[in]biasOptional, ignored if NULL. The biases have one dimension. Data type supported: Data types supported: S32 for QASYMM8 input, F32 for F32 input, F16 for F16 input.
[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.

Definition at line 115 of file NEDeconvolutionLayer.cpp.

116 {
117  // Perform validation step
118  ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, output);
119  ARM_COMPUTE_ERROR_THROW_ON(NEDeconvolutionLayer::validate(input->info(), weights->info(), (bias == nullptr) ? nullptr : bias->info(), output->info(), info));
120 
121  const DataLayout data_layout = input->info()->data_layout();
122 
123  _input = input;
124  _original_weights = weights;
125  _info = info;
126  _is_prepared = false;
127  _is_nchw = data_layout == DataLayout::NCHW;
128 
129  const unsigned int stride_x = info.stride().first;
130  const unsigned int stride_y = info.stride().second;
131 
134  auto out_dims = deconvolution_output_dimensions(input->info()->dimension(width_idx), input->info()->dimension(height_idx), weights->info()->dimension(width_idx),
135  weights->info()->dimension(height_idx),
136  info.pad().first, info.pad().second, stride_x, stride_y);
137 
138  const TensorShape output_shape = compute_deconvolution_output_shape(out_dims, *input->info(), *weights->info());
139  // Output auto initialization if not yet initialized
140  auto_init_if_empty(*output->info(), output_shape, 1, input->info()->data_type(), input->info()->quantization_info());
141 
142  _memory_group.manage(&_scaled_output);
143 
144  if(!_is_nchw)
145  {
146  _memory_group.manage(&_permuted_input);
147  _memory_group.manage(&_permuted_output);
148 
149  // Configure the function to transform the input tensor from NHWC -> NCHW
150  _permuted_input.info()->set_quantization_info(input->info()->quantization_info());
151  _permute_input.configure(input, &_permuted_input, PermutationVector(1U, 2U, 0U));
152  _permuted_input.info()->set_data_layout(DataLayout::NCHW);
153 
154  // Configure the function to transform the weights tensor from NHWC -> NCHW
155  _permuted_weights.info()->set_quantization_info(weights->info()->quantization_info());
156  _permute_weights.configure(weights, &_permuted_weights, PermutationVector(1U, 2U, 0U));
157  _permuted_weights.info()->set_data_layout(DataLayout::NCHW);
158 
159  // Find the upsampled dimensions and the padding needed for the convolution with stride 1 in order to match output shape
160  unsigned int padx = 0;
161  unsigned int pady = 0;
162  const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*_permuted_input.info(), *_permuted_weights.info(), stride_x, stride_y, out_dims, padx,
163  pady);
164 
165  TensorInfo scale_out_info(scale_out_shape, 1, _permuted_input.info()->data_type(), _permuted_input.info()->quantization_info());
166  scale_out_info.set_data_layout(DataLayout::NCHW);
167  _scaled_output.allocator()->init(scale_out_info);
168 
169  const PadStrideInfo upsample_info(stride_x, stride_y, padx / 2, pady / 2);
170  _upsample_f.configure(&_permuted_input, &_scaled_output, upsample_info);
171 
172  _weights_flipped.allocator()->init(*_permuted_weights.info()->clone());
173  _weights_flipped.info()->set_quantization_info(weights->info()->quantization_info());
174  _flip_weights.configure(&_permuted_weights, &_weights_flipped);
175 
176  // setup the function to convolve the upscaled output
177  const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL);
178 
179  _permuted_output.info()->set_quantization_info(output->info()->quantization_info());
180  _conv_f.configure(&_scaled_output, &_weights_flipped, bias, &_permuted_output, conv_info);
181 
182  // Configure the function to transform the convoluted output to NHWC
183  _permute_output.configure(&_permuted_output, output, PermutationVector(2U, 0U, 1U));
184  _permuted_output.info()->set_data_layout(DataLayout::NCHW);
185 
186  _permuted_input.allocator()->allocate();
187  _permuted_output.allocator()->allocate();
188  }
189  else
190  {
191  // Find the upsampled dimensions and the padding needed for the convolution with stride 1 in order to match output shape
192  unsigned int padx = 0;
193  unsigned int pady = 0;
194  const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input->info(), *weights->info(), stride_x, stride_y, out_dims, padx, pady);
195 
196  TensorInfo scale_out_info(scale_out_shape, 1, input->info()->data_type(), input->info()->quantization_info());
197  scale_out_info.set_data_layout(data_layout);
198  _scaled_output.allocator()->init(scale_out_info);
199  const PadStrideInfo upsample_info(stride_x, stride_y, padx / 2, pady / 2);
200  _upsample_f.configure(input, &_scaled_output, upsample_info);
201 
202  _weights_flipped.allocator()->init(weights->info()->clone()->set_data_layout(data_layout));
203  _flip_weights.configure(weights, &_weights_flipped);
204 
205  // setup the function to convolve the upscaled output
206  const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL);
207  _conv_f.configure(&_scaled_output, &_weights_flipped, bias, output, conv_info);
208  }
209  _scaled_output.allocator()->allocate();
210 }
const DataLayout data_layout
Definition: Im2Col.cpp:146
std::unique_ptr< ITensorInfo > clone() const override
Provide a clone of the current object of class T.
Definition: TensorInfo.cpp:306
TensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
Definition: CLTensor.cpp:35
void init(const TensorAllocator &allocator, const Coordinates &coords, TensorInfo &sub_info)
Shares the same backing memory with another tensor allocator, while the tensor info might be differen...
static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, const ITensorInfo *output, const PadStrideInfo &info)
Static function to check if given info will lead to a valid configuration of NEDeconvolutionLayer.
size_t dimension(size_t index) const override
Return the size of the requested dimension.
Definition: TensorInfo.h:223
virtual DataType data_type() const =0
Data type used for each element of the tensor.
QuantizationInfo quantization_info() const override
Get the quantization settings (scale and offset) of the tensor.
Definition: TensorInfo.h:293
Strides PermutationVector
Permutation vector.
Definition: Types.h:47
void configure(ITensor *input, const ITensor *weights, const ITensor *biases, ITensor *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_ERROR_THROW_ON(status)
Definition: Error.h:327
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...
Definition: Helpers.inl:201
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
Definition: Tensor.cpp:48
ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
Definition: Tensor.cpp:33
void configure(const ITensor *input, ITensor *output)
Set the input and output of the kernel.
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 manage(TensorType *obj)
Sets a object to be managed by the given memory group.
virtual ITensorInfo & set_data_layout(const DataLayout &data_layout)=0
Set the data layout of the tensor.
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
virtual ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info)=0
Set the quantization settings (scale and offset) of the tensor.
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, unsigned int &padx, unsigned int &pady)
Calculate the upsampled output shape used for deconvolution.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
Num samples, channels, height, width.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:161
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, unsigned int padx, unsigned int pady, unsigned int stride_x, unsigned int stride_y)
Returns expected width and height of the deconvolution's output tensor.
Definition: Utils.cpp:374
void configure(const ITensor *input, ITensor *output, const PadStrideInfo &info)
Configure the upsample CPP kernel.
Definition: CPPUpsample.cpp:31
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:326
void configure(const ITensor *input, ITensor *output, const PermutationVector &perm)
Configure the permute NEON kernel.
Definition: NEPermute.cpp:31
DataLayout
[DataLayout enum definition]
Definition: Types.h:114

References TensorAllocator::allocate(), Tensor::allocator(), ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::auto_init_if_empty(), arm_compute::test::validation::bias, arm_compute::CEIL, ICloneable< T >::clone(), TensorInfo::clone(), arm_compute::misc::shape_calculator::compute_deconvolution_output_shape(), arm_compute::misc::shape_calculator::compute_deconvolution_upsampled_shape(), CPPUpsample::configure(), NEPermute::configure(), CPPFlipWeightsKernel::configure(), NEConvolutionLayer::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(), TensorInfo::dimension(), arm_compute::get_data_layout_dimension_index(), arm_compute::HEIGHT, ITensor::info(), Tensor::info(), CLTensor::info(), arm_compute::test::validation::info, TensorAllocator::init(), MemoryGroupBase< TensorType >::manage(), arm_compute::NCHW, arm_compute::test::validation::output_shape, ITensorInfo::quantization_info(), TensorInfo::quantization_info(), ITensorInfo::set_data_layout(), TensorInfo::set_data_layout(), ITensorInfo::set_quantization_info(), arm_compute::U, NEDeconvolutionLayer::validate(), arm_compute::test::validation::weights, and arm_compute::WIDTH.

Referenced by arm_compute::test::validation::DATA_TEST_CASE().

◆ operator=() [1/2]

NEDeconvolutionLayer& operator= ( const NEDeconvolutionLayer )
delete

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

◆ operator=() [2/2]

NEDeconvolutionLayer& operator= ( NEDeconvolutionLayer &&  )
default

Allow instances of this class to be moved.

◆ 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 234 of file NEDeconvolutionLayer.cpp.

235 {
236  if(!_is_prepared)
237  {
238  ARM_COMPUTE_ERROR_ON(!_original_weights->is_used());
239  // Permute weights
240  if(!_is_nchw)
241  {
242  // Manually manage _permuted_weights
243  _permuted_weights.allocator()->allocate();
244  _permute_weights.run();
245  }
246 
247  // Run weights flipping and mark original weights tensor as unused
248  _weights_flipped.allocator()->allocate();
249  NEScheduler::get().schedule(&_flip_weights, Window::DimZ);
250  _original_weights->mark_as_unused();
251 
252  // Prepare convolution
253  _conv_f.prepare();
254 
255  if(!_weights_flipped.is_used())
256  {
257  _weights_flipped.allocator()->free();
258  }
259 
260  if(!_is_nchw)
261  {
262  // Manually manage _permuted_weights
263  // Free _permuted_weights as it not used after this method (prepare)
264  _permuted_weights.allocator()->free();
265  }
266 
267  _is_prepared = true;
268  }
269 }
void run() override final
Run the kernels contained in the function.
bool is_used() const
Flags if the tensor is used or not.
Definition: ITensor.cpp:162
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:337
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
Definition: Tensor.cpp:48
void mark_as_unused() const
Marks a tensor as unused.
Definition: ITensor.cpp:167
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
void free() override
Free allocated CPU memory.
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Definition: Window.h:47
void prepare() override
Prepare the function for executing.
static IScheduler & get()
Access the scheduler singleton.
Definition: Scheduler.cpp:96

References TensorAllocator::allocate(), Tensor::allocator(), ARM_COMPUTE_ERROR_ON, Window::DimZ, TensorAllocator::free(), Scheduler::get(), ITensor::is_used(), ITensor::mark_as_unused(), NEConvolutionLayer::prepare(), INESimpleFunctionNoBorder::run(), and IScheduler::schedule().

Referenced by NEDeconvolutionLayer::run().

◆ 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 212 of file NEDeconvolutionLayer.cpp.

213 {
214  prepare();
215 
216  MemoryGroupResourceScope scope_mg(_memory_group);
217 
218  // Permute input
219  if(!_is_nchw)
220  {
221  _permute_input.run();
222  }
223 
224  _upsample_f.run();
225  _conv_f.run();
226 
227  // Permute output
228  if(!_is_nchw)
229  {
230  _permute_output.run();
231  }
232 }
void run() override final
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.
void run() override final
Run the kernels contained in the function.

References NEDeconvolutionLayer::prepare(), INESimpleFunctionNoBorder::run(), ICPPSimpleFunction::run(), and NEConvolutionLayer::run().

◆ validate()

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

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

Parameters
[in]inputInput tensor info. 3 lower dimensions represent a single input, and an optional 4th dimension for batch of inputs. Data types supported: F32/F16/QASYMM8.
[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: Data types supported: S32 for QASYMM8 input, F32 for F32 input, F16 for F16 input.
[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.
Returns
a status

Definition at line 57 of file NEDeconvolutionLayer.cpp.

58 {
63  const unsigned int width_idx = get_data_layout_dimension_index(weights->data_layout(), DataLayoutDimension::WIDTH);
64  const unsigned int height_idx = get_data_layout_dimension_index(weights->data_layout(), DataLayoutDimension::HEIGHT);
65  ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(width_idx) != weights->dimension(height_idx));
66  ARM_COMPUTE_RETURN_ERROR_ON(weights->dimension(width_idx) < 1);
67  ARM_COMPUTE_RETURN_ERROR_ON(!info.padding_is_symmetric());
68 
69  const unsigned int stride_x = info.stride().first;
70  const unsigned int stride_y = info.stride().second;
71 
72  auto out_dims = deconvolution_output_dimensions(input->dimension(width_idx), input->dimension(height_idx), weights->dimension(width_idx), weights->dimension(height_idx),
73  info.pad().first, info.pad().second, stride_x, stride_y);
74 
76  if(bias != nullptr)
77  {
78  if(is_data_type_quantized_asymmetric(input->data_type()))
79  {
81  }
82  else
83  {
85  }
86  }
87 
88  if(output->tensor_shape().total_size() > 0)
89  {
91 
92  const TensorShape output_shape = compute_deconvolution_output_shape(out_dims, *input, *weights);
93 
94  ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(Window::DimX) != output_shape.x(), "Output's width is invalid.");
95  ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(Window::DimY) != output_shape.y(), "Output's height is invalid.");
96  ARM_COMPUTE_RETURN_ERROR_ON_MSG(output->dimension(Window::DimZ) != output_shape.z(), "Output's depth is invalid.");
97  }
98 
99  unsigned int padx = 0;
100  unsigned int pady = 0;
101  const TensorShape scale_out_shape = compute_deconvolution_upsampled_shape(*input, *weights, stride_x, stride_y, out_dims, padx, pady);
102  TensorInfo scale_out_info(input->clone()->set_is_resizable(true).reset_padding().set_tensor_shape(scale_out_shape));
103  const PadStrideInfo conv_info(1, 1, 0, 0, 0, 0, DimensionRoundingType::CEIL);
104 
105  const unsigned int batches_idx = get_data_layout_dimension_index(weights->data_layout(), DataLayoutDimension::BATCHES);
106  const unsigned int channel_idx = get_data_layout_dimension_index(weights->data_layout(), DataLayoutDimension::CHANNEL);
107  ARM_COMPUTE_RETURN_ERROR_ON(input->dimension(batches_idx) != scale_out_info.dimension(batches_idx));
108  ARM_COMPUTE_RETURN_ERROR_ON(input->dimension(channel_idx) != scale_out_info.dimension(channel_idx));
109 
110  ARM_COMPUTE_RETURN_ON_ERROR(NEConvolutionLayer::validate(&scale_out_info, weights, bias, output, conv_info, WeightsInfo()));
111 
112  return Status{};
113 }
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
Definition: Validate.h:494
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Definition: Validate.h:545
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:193
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:791
1 channel, 1 F32 per channel
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Definition: Error.h:244
1 channel, 1 F16 per channel
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
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Definition: Window.h:43
quantized, asymmetric fixed-point 8-bit number
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond,...)
If the condition is true, an error is returned.
Definition: Error.h:214
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, unsigned int &padx, unsigned int &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:1030
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:163
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Definition: Window.h:45
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, unsigned int padx, unsigned int pady, unsigned int stride_x, unsigned int stride_y)
Returns expected width and height of the deconvolution's output tensor.
Definition: Utils.cpp:374
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Definition: Window.h:47
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:326
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 NEConvolutionLayer.

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::BATCHES, arm_compute::test::validation::bias, 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, ITensorInfo::data_type(), arm_compute::deconvolution_output_dimensions(), ITensorInfo::dimension(), Window::DimX, Window::DimY, Window::DimZ, 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::S32, ITensorInfo::tensor_shape(), TensorShape::total_size(), NEConvolutionLayer::validate(), arm_compute::test::validation::weights, and arm_compute::WIDTH.

Referenced by NEDeconvolutionLayer::configure().


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