Fixed-capacity small-vector describing tensor dimensions (rank up to MaxRank).
More...
#include <tensor_utilities.h>
|
| | Shape () noexcept=default |
| |
| | Shape (size_t new_rank, Index value) |
| | Builds a shape of the given rank with every dimension set to value.
|
| |
| | Shape (initializer_list< Index > list) |
| | Builds a shape from a brace-enclosed list of dimensions.
|
| |
| const Index * | begin () const noexcept |
| |
| const Index * | end () const noexcept |
| |
| const Index & | operator[] (size_t i) const noexcept |
| |
| Index & | operator[] (size_t i) noexcept |
| |
| Index & | back () |
| |
| const Index & | back () const |
| |
| bool | empty () const noexcept |
| |
| Index | dim_or_zero (size_t i) const noexcept |
| | Returns dims[i] when i is in range, otherwise 0.
|
| |
| Index | size () const noexcept |
| | Returns the number of elements (product of all dimensions).
|
| |
| void | clear () noexcept |
| | Resets the shape to rank 0 without freeing storage.
|
| |
| void | push_back (Index value) noexcept |
| | Appends a dimension to the shape (silently no-op if already at MaxRank).
|
| |
| bool | operator== (const Shape &other) const noexcept |
| |
| Shape & | append (const Shape &other) |
| | Appends another shape's dimensions to this one, stopping at MaxRank.
|
| |
|
| static constexpr size_t | MaxRank = 4 |
| |
Fixed-capacity small-vector describing tensor dimensions (rank up to MaxRank).
◆ Shape() [1/3]
◆ Shape() [2/3]
| opennn::Shape::Shape |
( |
size_t | new_rank, |
|
|
Index | value ) |
|
inline |
Builds a shape of the given rank with every dimension set to value.
◆ Shape() [3/3]
| opennn::Shape::Shape |
( |
initializer_list< Index > | list | ) |
|
|
inline |
Builds a shape from a brace-enclosed list of dimensions.
◆ append()
| Shape & opennn::Shape::append |
( |
const Shape & | other | ) |
|
|
inline |
Appends another shape's dimensions to this one, stopping at MaxRank.
◆ back() [1/2]
| Index & opennn::Shape::back |
( |
| ) |
|
|
inline |
◆ back() [2/2]
| const Index & opennn::Shape::back |
( |
| ) |
const |
|
inlinenodiscard |
◆ begin()
| const Index * opennn::Shape::begin |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ clear()
| void opennn::Shape::clear |
( |
| ) |
|
|
inlinenoexcept |
Resets the shape to rank 0 without freeing storage.
◆ dim_or_zero()
| Index opennn::Shape::dim_or_zero |
( |
size_t | i | ) |
const |
|
inlinenodiscardnoexcept |
Returns dims[i] when i is in range, otherwise 0.
◆ empty()
| bool opennn::Shape::empty |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ end()
| const Index * opennn::Shape::end |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ operator==()
| bool opennn::Shape::operator== |
( |
const Shape & | other | ) |
const |
|
inlinenodiscardnoexcept |
◆ operator[]() [1/2]
| const Index & opennn::Shape::operator[] |
( |
size_t | i | ) |
const |
|
inlinenodiscardnoexcept |
◆ operator[]() [2/2]
| Index & opennn::Shape::operator[] |
( |
size_t | i | ) |
|
|
inlinenoexcept |
◆ push_back()
| void opennn::Shape::push_back |
( |
Index | value | ) |
|
|
inlinenoexcept |
Appends a dimension to the shape (silently no-op if already at MaxRank).
◆ size()
| Index opennn::Shape::size |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Returns the number of elements (product of all dimensions).
◆ operator<<
| ostream & operator<< |
( |
ostream & | os, |
|
|
const Shape & | shape ) |
|
friend |
◆ dims
| Index opennn::Shape::dims[MaxRank] = {0} |
◆ MaxRank
| size_t opennn::Shape::MaxRank = 4 |
|
staticconstexpr |
◆ rank
| size_t opennn::Shape::rank = 0 |