|
Mila 0.13.48
Deep Neural Network Library
|
Fixed-capacity inline shape descriptor for N-dimensional tensors. More...
Public Member Functions | |
| TensorShape ()=default | |
| TensorShape (const dim_t *first, const dim_t *last) | |
| Constructs from a contiguous pointer range of dimension sizes. | |
| TensorShape (std::initializer_list< dim_t > il) | |
| Constructs from a brace-enclosed list of dimension sizes. | |
| dim_t & | back () |
| dim_t | back () const |
| dim_t * | begin () |
| const dim_t * | begin () const |
| dim_t * | data () |
| const dim_t * | data () const |
| bool | empty () const |
| dim_t * | end () |
| const dim_t * | end () const |
| bool | operator== (const TensorShape &other) const noexcept |
| Equality compares only the active ndim dimensions. | |
| dim_t & | operator[] (size_t i) |
| dim_t | operator[] (size_t i) const |
| size_t | size () const |
Public Attributes | |
| std::array< dim_t, MaxRank > | dims {} |
| uint8_t | ndim { 0 } |
Static Public Attributes | |
| static constexpr uint8_t | MaxRank = 6 |
Fixed-capacity inline shape descriptor for N-dimensional tensors.
Stores up to MaxRank dimension sizes inline with no heap allocation. The active rank is tracked by ndim; unused slots are zero-initialized and ignored by all operations. An empty shape (ndim == 0) represents a scalar tensor.
MaxRank = 6 covers all current Mila architectures (2-4D) and common research extensions including video and spatiotemporal models (5D) with one dimension of safety margin. shape_t, stride_t, and index_t are all aliases of TensorShape since all three are structurally identical fixed-capacity int64 sequences.
|
default |

|
inline |
Constructs from a brace-enclosed list of dimension sizes.
| il | Dimension sizes in row-major order. |
| std::invalid_argument | if il.size() > MaxRank. |
Constructs from a contiguous pointer range of dimension sizes.
Covers serialization boundaries where shapes arrive as contiguous storage (e.g. std::vector<int64_t>::data()). The range [first, last) must not exceed MaxRank elements.
| first | Pointer to the first dimension size. |
| last | One-past-end pointer. |
| std::invalid_argument | if the range length exceeds MaxRank. |
|
inline |
|
inline |

|
inline |
|
inline |

|
inline |
|
inline |

|
inline |

|
inline |
|
inline |

|
inlinenoexcept |
Equality compares only the active ndim dimensions.
Unused slots (indices >= ndim) are ignored regardless of their values.

|
inline |
|
inline |
|
inline |

|
staticconstexpr |
| uint8_t Mila::Dnn::TensorShape::ndim { 0 } |