24 #ifndef __ARM_COMPUTE_DIMENSIONS_H__ 25 #define __ARM_COMPUTE_DIMENSIONS_H__ 47 #ifndef DOXYGEN_SKIP_THIS 52 template <
typename... Ts>
54 : _id{ { dims... } }, _num_dimensions{
sizeof...(dims) }
73 void set(
size_t dimension, T value)
76 _id[dimension] = value;
77 _num_dimensions = std::max(_num_dimensions, dimension + 1);
105 return _id[dimension];
110 return _num_dimensions;
120 typename std::array<T, num_max_dimensions>::iterator
begin()
125 typename std::array<T, num_max_dimensions>::const_iterator
begin()
const 130 typename std::array<T, num_max_dimensions>::const_iterator
cbegin()
const 135 typename std::array<T, num_max_dimensions>::iterator
end()
140 typename std::array<T, num_max_dimensions>::const_iterator
end()
const 145 typename std::array<T, num_max_dimensions>::const_iterator
cend()
const 151 std::array<T, num_max_dimensions> _id;
152 size_t _num_dimensions{ 0 };
155 template <
typename T>
std::array< T, num_max_dimensions >::const_iterator cbegin() const
Returns a read-only (constant) iterator that points to the first element in the dimension array...
T z() const
Alias to access the size of the third dimension.
Dimensions & operator=(const Dimensions &)=default
Allow instances of this class to be copied.
T operator[](size_t dimension) const
Generic accessor to get the size of any dimension.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
std::array< T, num_max_dimensions >::const_iterator begin() const
Returns a read-only (constant) iterator that points to the first element in the dimension array...
constexpr size_t MAX_DIMS
T x() const
Alias to access the size of the first dimension.
std::array< T, num_max_dimensions >::const_iterator end() const
Returns a read-only (constant) iterator that points one past the last element in the dimension array...
std::array< T, num_max_dimensions >::const_iterator cend() const
Returns a read-only (constant) iterator that points one past the last element in the dimension array...
Dimensions with dimensionality.
std::array< T, num_max_dimensions >::iterator begin()
Returns a read/write iterator that points to the first element in the dimension array.
std::array< T, num_max_dimensions >::iterator end()
Returns a read/write iterator that points one past the last element in the dimension array...
T y() const
Alias to access the size of the second dimension.
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
void set_num_dimensions(size_t num_dimensions)
Set number of dimensions.
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
Dimensions(const Dimensions &)=default
Allow instances of this class to be copy constructed.
virtual ~Dimensions()=0
Pure virtual destructor.