24 #ifndef ARM_COMPUTE_HELPERS_H 25 #define ARM_COMPUTE_HELPERS_H 72 constexpr
size_t offset()
const;
80 constexpr uint8_t *
ptr()
const;
86 void reset(
size_t dimension);
95 : _dim_start(0), _stride(0)
103 std::array<Dimension, Coordinates::num_max_dimensions> _dims;
114 template <
typename L,
typename... Ts>
124 template <
typename T>
127 auto dimensions_copy = utility::make_array<Dimensions<T>::num_max_dimensions>(dimensions.
begin(), dimensions.
end());
130 T dimension_val = (perm[i] < dimensions.
num_dimensions()) ? dimensions_copy[perm[i]] : 0;
131 dimensions.
set(i, dimension_val);
147 size_t dimension_val = (perm[i] <
shape.num_dimensions()) ? shape_copy[perm[i]] : 1;
148 shape.set(i, dimension_val,
false,
false);
213 int num_tiles_x = std::ceil((in_dims.
width - (kernel_size.
width - 1) +
conv_info.pad_left() +
conv_info.pad_right()) / static_cast<float>(output_tile_size.
width));
217 num_tiles_x = std::min(num_tiles_x, static_cast<int>(in_dims.
width));
218 num_tiles_y = std::min(num_tiles_y, static_cast<int>(in_dims.
height));
220 return Size2D(num_tiles_x, num_tiles_y);
230 template <
typename T>
233 return x >= 0 ? x % m : (x % m + m) % m;
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
InterpolationPolicy
Interpolation method.
Coordinates index2coords(const TensorShape &shape, int index)
Convert a linear index into n-dimensional coordinates.
void increment(size_t dimension)
Increment the iterator along the specified dimension of the step value associated to the dimension.
DataLayoutDimension
[DataLayout enum definition]
const DataLayout data_layout
Size2D compute_winograd_convolution_tiles(const Size2D &in_dims, const Size2D &kernel_size, const Size2D &output_tile_size, const PadStrideInfo &conv_info)
Calculate the number of output tiles required by Winograd Convolution layer.
Interface for CPU tensor.
Copyright (c) 2017-2021 Arm Limited.
size_t height
Height of the image region or rectangle.
void permute(Dimensions< T > &dimensions, const PermutationVector &perm)
Permutes given Dimensions according to a permutation vector.
T wrap_around(T x, T m)
Wrap-around a number within the range 0 <= x < m.
Dimensions with dimensionality.
int coords2index(const TensorShape &shape, const Coordinates &coord)
Convert n-dimensional coordinates into a linear index.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
Padding and stride information class.
std::array< T, num_max_dimensions >::iterator begin()
Returns a read/write iterator that points to the first element in the dimension array.
DataLayoutDimension get_index_data_layout_dimension(const DataLayout data_layout, const size_t index)
Get the DataLayoutDimension of a given index and layout.
constexpr Iterator()
Default constructor to create an empty iterator.
TensorInfo src_info(src_shape, 1, data_type)
Strides of an item in bytes.
ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, const TensorShape &dst_shape, InterpolationPolicy interpolate_policy, SamplingPolicy sampling_policy, bool border_undefined)
Helper function to calculate the Valid Region for Scale.
void reset(size_t dimension)
Move the iterator back to the beginning of the specified dimension.
std::array< T, num_max_dimensions >::iterator end()
Returns a read/write iterator that points one past the last element in the dimension array.
size_t width
Width of the image region or rectangle.
Class for specifying the size of an image or rectangle.
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
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...
Coordinates & convert_negative_axis(Coordinates &coords, int max_value)
Convert negative coordinates to positive in the range [0, num_dims_input].
constexpr size_t offset() const
Return the offset in bytes from the first element to the current position of the iterator.
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.
DataLayout
[DataLayout enum definition]
Describe a multidimensional execution window.
SamplingPolicy
Available Sampling Policies.