33 : _info(info), _start_x(start_x), _start_y(start_y), _end_x(end_x), _end_y(end_y)
49 return input_valid_region;
59 anchor.
set(0, std::max<int>(0, _start_x));
62 anchor.
set(1, std::max<int>(0, _start_y));
73 return input_valid_region;
96 bool window_modified =
false;
101 const int front_pad_y_available = -
static_cast<int>(offset_first_element / strides[1]);
103 if(_start_y < front_pad_y_available)
105 window_modified =
true;
111 if(_end_y > static_cast<int>(shape[1]))
114 const int tail_pad_y_available = (stride_z / strides[1]) - shape[1];
116 if(static_cast<int>(shape[1]) + tail_pad_y_available < _end_y)
118 window_modified =
true;
128 const int front_pad_x_available = -std::min<int>(
static_cast<int>(offset_first_element), stride_y - shape[0] * strides[0]) /
static_cast<int>(strides[0]);
130 if(_start_x < front_pad_x_available)
132 window_modified =
true;
136 if(!window_modified && _end_x > static_cast<int>(shape[0]))
138 const int tail_pad_x_available = (stride_y / strides[0]) - shape[0];
140 if(static_cast<int>(shape[0]) + tail_pad_x_available < _end_x)
142 window_modified =
true;
157 return window_modified;
173 padding.
left = std::max(0, -_start_x);
174 padding.
right = std::max<int>(0, _end_x - shape[0]);
175 padding.
top = std::max(0, -_start_y);
176 padding.
bottom = std::max<int>(0, _end_y - shape[1]);
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
unsigned int top
top of the border
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
TensorShape shape
Shape of the valid region.
ValidRegion compute_valid_region(const Window &window, ValidRegion input_valid_region) const
Compute the valid region based on the static access pattern and valid region of the inputs...
Container for 2D border size.
Store the tensor's metadata.
Describe one of the image's dimensions with a start, end and step.
unsigned int bottom
bottom of the border
Copyright (c) 2017-2021 Arm Limited.
virtual void set_valid_region(const ValidRegion &valid_region)=0
Set the valid region of the tensor.
bool update_padding_if_needed(const Window &window) override
Increase the padding to be large enough for the window.
virtual bool is_resizable() const =0
Flag indicating whether the size of the tensor can be changed.
bool update_window_if_needed(Window &window) const override
Shrink the window if padding is not large enough.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
unsigned int left
left of the border
unsigned int right
right of the border
Strides of an item in bytes.
virtual size_t offset_first_element_in_bytes() const =0
The offset from the beginning of the memory allocation to the first element of the tensor...
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
AccessWindowStatic(ITensorInfo *info, int start_x, int start_y, int end_x, int end_y)
Constructor for a static access pattern.
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.
Container for valid region of a window.
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
virtual bool extend_padding(const PaddingSize &padding)=0
Update the offset to the first element, the strides and the total size.
Describe a multidimensional execution window.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Coordinates anchor
Anchor for the start of the valid region.
void set_valid_region(const Window &window, const ValidRegion &input_valid_region)
Set the valid region based on the static access pattern and valid region of the inputs.