24.04
|
Go to the documentation of this file.
33 : _info(
info), _start_x(start_x), _start_y(start_y), _end_x(end_x), _end_y(end_y)
39 bool border_undefined,
52 return input_valid_region;
62 anchor.
set(0, std::max<int>(0, _start_x));
65 anchor.
set(1, std::max<int>(0, _start_y));
76 return input_valid_region;
99 bool window_modified =
false;
104 const int front_pad_y_available = -
static_cast<int>(offset_first_element / strides[1]);
106 if (_start_y < front_pad_y_available)
108 window_modified =
true;
112 if (!window_modified)
114 if (_end_y >
static_cast<int>(
shape[1]))
117 const int tail_pad_y_available = (stride_z / strides[1]) -
shape[1];
119 if (
static_cast<int>(
shape[1]) + tail_pad_y_available < _end_y)
121 window_modified =
true;
125 if (!window_modified)
131 const int front_pad_x_available =
132 -std::min<int>(
static_cast<int>(offset_first_element), stride_y -
shape[0] * strides[0]) /
133 static_cast<int>(strides[0]);
135 if (_start_x < front_pad_x_available)
137 window_modified =
true;
141 if (!window_modified && _end_x >
static_cast<int>(
shape[0]))
143 const int tail_pad_x_available = (stride_y / strides[0]) -
shape[0];
145 if (
static_cast<int>(
shape[0]) + tail_pad_x_available < _end_x)
147 window_modified =
true;
162 return window_modified;
178 padding.
left = std::max(0, -_start_x);
179 padding.
right = std::max<int>(0, _end_x -
shape[0]);
180 padding.
top = std::max(0, -_start_y);
181 padding.
bottom = std::max<int>(0, _end_y -
shape[1]);
unsigned int right
right of the border
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.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Container for 2D border size.
bool update_window_if_needed(Window &window) const override
Shrink the window if padding is not large enough.
virtual bool extend_padding(const PaddingSize &padding)=0
Update the offset to the first element, the strides and the total size.
AccessWindowStatic(ITensorInfo *info, int start_x, int start_y, int end_x, int end_y)
Constructor for a static access pattern.
unsigned int top
top of the border
Strides of an item in bytes.
unsigned int bottom
bottom of the border
bool update_padding_if_needed(const Window &window) override
Increase the padding to be large enough for the window.
Container for valid region of a window.
#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.
virtual bool is_resizable() const =0
Flag indicating whether the size of the tensor can be changed.
Describe a multidimensional execution window.
TensorShape shape
Shape of the valid region.
Copyright (c) 2017-2024 Arm Limited.
virtual void set_valid_region(const ValidRegion &valid_region)=0
Set the valid region of the tensor.
unsigned int left
left of the border
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.
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.
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.
Store the tensor's metadata.
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.
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
Coordinates anchor
Anchor for the start of the valid region.