24.02
|
Go to the documentation of this file.
24 #ifndef ACL_ARM_COMPUTE_CORE_WINDOW_H
25 #define ACL_ARM_COMPUTE_CORE_WINDOW_H
43 static constexpr
size_t DimX = 0;
45 static constexpr
size_t DimY = 1;
47 static constexpr
size_t DimZ = 2;
49 static constexpr
size_t DimW = 3;
51 static constexpr
size_t DimV = 4;
55 : _dims(), _is_broadcasted(utility::generate_array<bool,
Coordinates::num_max_dimensions, false>::value)
135 return (lhs._start == rhs._start) && (lhs._end == rhs._end) && (lhs._step == rhs._step);
152 constexpr
const Dimension &
operator[](
size_t dimension)
const;
186 void set(
size_t dimension,
const Dimension &dim);
214 void shift(
size_t dimension,
int shift_value);
234 void adjust(
size_t dimension,
int adjust_value,
bool is_at_start);
243 void scale(
size_t dimension,
float scale_value);
292 return first_slice_window<1>();
300 return first_slice_window<2>();
308 return first_slice_window<3>();
316 return first_slice_window<4>();
328 return slide_window_slice<1>(
slice);
340 return slide_window_slice<2>(
slice);
352 return slide_window_slice<3>(
slice);
364 return slide_window_slice<4>(
slice);
445 template <
unsigned int window_dimension>
446 Window first_slice_window()
const;
456 template <
unsigned int window_dimension>
460 std::array<Dimension, Coordinates::num_max_dimensions> _dims;
461 std::array<bool, Coordinates::num_max_dimensions> _is_broadcasted;
465 #endif // ACL_ARM_COMPUTE_CORE_WINDOW_H
constexpr int start() const
Return the start of the dimension.
SimpleTensor< float > src
void scale(size_t dimension, float scale_value)
Scale the values of a given dimension by the given scale_value.
constexpr int step() const
Return the step of the dimension.
static constexpr size_t DimV
Alias for dimension 4 also known as V dimension.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Window collapse_if_possible(const Window &full_window, size_t first, size_t last, bool *has_collapsed=nullptr) const
Collapse the dimensions between first and last if possible.
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
void set_end(int end)
Set the dimension's end.
constexpr size_t num_iterations(size_t dimension) const
Return the number of iterations needed to iterate through a given dimension.
Window shift_dimensions(unsigned int shift_value, unsigned int start_dim=0) const
Shift down all the dimensions of a window starting from the specified dimension.
void shift(size_t dimension, int shift_value)
Shift the values of a given dimension by the given shift_value.
bool slide_window_slice_2D(Window &slice) const
Slide the passed 2D window slice.
Window first_slice_window_1D() const
First 1D slice of the window.
Window split_window(size_t dimension, size_t id, size_t total) const
Split a window into a set of sub windows along a given dimension.
void set_dimension_step(size_t dimension, int step)
Set the step of a given dimension.
Dimension & operator=(const Dimension &d)=default
Default assignment operator to allow dimensions to be copied.
friend bool operator==(const Dimension &lhs, const Dimension &rhs)
Check whether two Dimensions are equal.
constexpr Window()
Default constructor: create a window containing a single element.
Window collapse(const Window &full_window, size_t first, size_t last=Coordinates::num_max_dimensions) const
Collapse the dimensions between first and last.
friend void swap(Window &lhs, Window &rhs)
Friend function that swaps the contents of two windows.
Window broadcast_if_dimension_le_one(const ITensorInfo &info) const
Don't advance in the dimension where shape of info is less equal to 1.
TensorShape shape() const
Return the shape of the window in number of steps.
constexpr const Dimension & y() const
Alias to access the second dimension of the window.
static constexpr size_t DimW
Alias for dimension 3 also known as W dimension.
void validate() const
Will validate all the window's dimensions' values when asserts are enabled.
friend bool operator==(const Window &lhs, const Window &rhs)
Check whether two Windows are equal.
bool is_broadcasted(size_t dimension) const
Return whether a dimension has been broadcasted.
void set_step(int step)
Set the dimension's step.
bool slide_window_slice_3D(Window &slice) const
Slide the passed 3D window slice.
Window & operator=(const Window &rhs)
Copy assignment operator.
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.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
void set_broadcasted(size_t dimension)
Set the dimension as broadcasted dimension.
Window first_slice_window_3D() const
First 3D slice of the window.
constexpr const Dimension & operator[](size_t dimension) const
Read only access to a given dimension of the window.
Window collapse_if_possible(const Window &full_window, size_t first, bool *has_collapsed=nullptr) const
Collapse the dimensions higher than first if possible.
constexpr Dimension(int start=0, int end=1, int step=1)
Constructor, by default creates a dimension of 1.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
size_t num_iterations_total() const
Return the total number of iterations needed to iterate through the entire window.
Window broadcast_if_dimension_le_one(const TensorShape &shape) const
Don't advance in the dimension where shape is less equal to 1.
Store the tensor's metadata.
Window first_slice_window_4D() const
First 4D slice of the window.
bool slide_window_slice_1D(Window &slice) const
Slide the passed 1D window slice.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
constexpr int end() const
Return the end of the dimension.
bool slide_window_slice_4D(Window &slice) const
Slide the passed 4D window slice.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
Window first_slice_window_2D() const
First 2D slice of the window.
constexpr const Dimension & z() const
Alias to access the third dimension of the window.
void adjust(size_t dimension, int adjust_value, bool is_at_start)
Adjust the start or end of a given dimension by the given value.