24.02.1
|
Go to the documentation of this file.
50 if (output->total_size() != 0)
58 Status validate_arguments_static(
const ITensorInfo *
input,
61 const ITensorInfo *output,
73 if (output->total_size() != 0)
79 input->data_layout(),
input->tensor_shape(), block_shape_x, block_shape_y, crop_info);
80 const TensorInfo
expected_output = output->clone()->set_tensor_shape(expected_output_shape);
90 _block_shape(nullptr),
105 _block_shape = block_shape;
107 _data_layout =
input->info()->data_layout();
111 ICPPKernel::configure(win);
119 input->info()->data_layout(),
input->info()->tensor_shape(), block_shape_x, block_shape_y);
125 validate_arguments_static(
input->info(), block_shape_x, block_shape_y, output->
info(), crop_info));
129 _block_shape_x = block_shape_x;
130 _block_shape_y = block_shape_y;
131 _data_layout =
input->info()->data_layout();
132 _crop_info = crop_info;
136 ICPPKernel::configure(win);
148 int32_t block_shape_x,
149 int32_t block_shape_y,
164 if (_block_shape !=
nullptr)
167 _block_shape_x = *(
reinterpret_cast<const int *
>(_block_shape->
ptr_to_element(0)));
168 _block_shape_y = *(
reinterpret_cast<const int *
>(_block_shape->
ptr_to_element(1)));
187 const int x =
id.
x();
188 const int y =
id.y();
189 const int z =
id.z();
191 const int x_c = x + _crop_info.
left;
192 const int y_c = y + _crop_info.
top;
195 batch_id + ((x_c % _block_shape_x) + (y_c % _block_shape_y) * _block_shape_x) * batch_size;
196 const int in_x = x_c / _block_shape_x;
197 const int in_y = y_c / _block_shape_y;
216 const int x =
id.
y();
217 const int y =
id.z();
220 const int x_c = x + _crop_info.
left;
221 const int y_c = y + _crop_info.
top;
224 batch_id + ((x_c % _block_shape_x) + (y_c % _block_shape_y) * _block_shape_x) * batch_size;
225 const int in_x = x_c / _block_shape_x;
226 const int in_y = y_c / _block_shape_y;
@ NCHW
Num samples, channels, height, width.
Class to describe a number of elements in each dimension.
void configure(const ITensor *input, const ITensor *block_shape, ITensor *output)
Initialise the kernel's inputs and output.
DataLayout
[DataLayout enum definition]
SimpleTensor< uint8_t > expected_output(output_shape, DataType::QASYMM8, 1, qasymm)
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
static Status validate(const ITensorInfo *input, const ITensorInfo *block_shape, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NEBatchToSpaceLayerKerne...
Interface for CPU tensor.
size_t top
Padding across the height dimension on the top, in elements.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
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(...)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
size_t left
Padding across the width dimension on the left, in elements.
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&...iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Iterator updated by execute_window_loop for each window element.
#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...
constexpr const Dimension & y() const
Alias to access the second dimension of the window.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
bool slide_window_slice_3D(Window &slice) const
Slide the passed 3D window slice.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Describe one of the image's dimensions with a start, end and step.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
Window first_slice_window_3D() const
First 3D slice of the window.
const Window & window() const
The maximum window the kernel can be executed on.
NEBatchToSpaceLayerKernel()
Default constructor.
Information about executing thread and CPU.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
TensorShape compute_batch_to_space_shape(DataLayout data_layout, const TensorShape &input, int block_x, int block_y, const CropInfo &crop_info=CropInfo{})
Calculate the batch to space output shape of a tensor.
uint8_t * ptr_to_element(const Coordinates &id) const
Return a pointer to the element at the passed coordinates.
@ UNKNOWN
Unknown CL kernel type.
@ S32
signed 32-bit number
Padding2D CropInfo
Class for holding information related to cropping.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
void run(const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
Store the tensor's metadata.
Padding and stride information class.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
@ UNKNOWN
Unknown data type.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.