Template Class Shape
Defined in File Shape.hpp
Class Documentation
-
template<class T, int N>
class Shape Template class representing an N-dimensional shape.
This class is designed to encapsulate the shape of an N-dimensional tensor, where the size in each dimension is of type T.
- Template Parameters:
T – The type of the size in each dimension (e.g., int, size_t).
N – The maximum number of dimensions this shape can represent.
Public Types
-
using value_type = typename Data::value_type
-
using size_type = int
-
using reference = typename Data::reference
-
using const_reference = typename Data::const_reference
-
using iterator = typename Data::iterator
-
using const_iterator = typename Data::const_iterator
Public Functions
-
Shape()
-
explicit Shape(size_type size)
Construct with a given rank, sizes default to 0.
- Parameters:
size – The rank of the shape.
-
Shape(const T *data, size_t n)
Constructor using a buffer.
Constructs a shape by copying ‘n’ elements from the buffer pointed by ‘data’.
- Parameters:
data – Pointer to the buffer.
n – Number of elements to copy from the buffer.
-
Shape(std::initializer_list<value_type> shape)
-
const_reference operator[](int i) const
-
bool empty() const
Check if the shape is empty.
-
const_iterator begin() const
-
const_iterator end() const
-
const_iterator cbegin() const
-
const_iterator cend() const