48 if(output->total_size() != 0)
56 Status validate_arguments_static(
const ITensorInfo *input,
const int block_shape_x,
const int block_shape_y,
const ITensorInfo *output)
67 if(output->total_size() != 0)
84 : _input(nullptr), _block_shape(nullptr), _output(nullptr), _data_layout(
DataLayout::
UNKNOWN), _block_shape_x(), _block_shape_y()
94 _block_shape = block_shape;
100 ICPPKernel::configure(win);
115 _block_shape_x = block_shape_x;
116 _block_shape_y = block_shape_y;
121 ICPPKernel::configure(win);
144 if(_block_shape !=
nullptr)
147 _block_shape_x = *(
reinterpret_cast<const int *
>(_block_shape->
ptr_to_element(0)));
148 _block_shape_y = *(
reinterpret_cast<const int *
>(_block_shape->
ptr_to_element(1)));
152 const int r = (batch_size / (_block_shape_x * _block_shape_y));
174 const int x =
id.
x();
175 const int y =
id.y();
176 const int z =
id.z();
178 const int w = batch_id % r;
179 const int out_x = x * _block_shape_x + (batch_id / r) % _block_shape_x;
180 const int out_y = y * _block_shape_y + (batch_id / r) / _block_shape_x;
197 const int z =
id.
x();
198 const int x =
id.y();
199 const int y =
id.z();
201 const int w = batch_id % r;
202 const int out_x = x * _block_shape_x + (batch_id / r) % _block_shape_x;
203 const int out_y = y * _block_shape_y + (batch_id / r) / _block_shape_x;
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
const Window & window() const
The maximum window the kernel can be executed on.
uint8_t * ptr_to_element(const Coordinates &id) const
Return a pointer to the element at the passed coordinates.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
const DataLayout data_layout
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
Describe one of the image's dimensions with a start, end and step.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Interface for Neon tensor.
Copyright (c) 2017-2021 Arm Limited.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
1 channel, 1 S32 per channel
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Class to describe a number of elements in each dimension.
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...
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.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
bool slide_window_slice_3D(Window &slice) const
Slide the passed 3D window slice.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
Num samples, channels, height, width.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Information about executing thread and CPU.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void run(const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)
TensorShape compute_batch_to_space_shape(const ITensorInfo *input, const int block_x, const int block_y)
Calculate the batch to space output shape of a tensor.
Window first_slice_window_4D() const
First 4D slice of the window.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
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...
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
Iterator updated by execute_window_loop for each window element.
Window first_slice_window_3D() const
First 3D slice of the window.
void configure(const ITensor *input, const ITensor *block_shape, ITensor *output)
Initialise the kernel's inputs and output.
DataLayout
[DataLayout enum definition]
Describe a multidimensional execution window.
NEBatchToSpaceLayerKernel()
Default constructor.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.