![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Describes the shape of a tensor as a vector of dimension sizes. More...
#include <tensor_bridge.hpp>
Public Member Functions | |
| TensorShape ()=default | |
| Default constructor: scalar shape (empty dims). | |
| TensorShape (std::vector< int64_t > d) | |
| Construct from a vector of dimensions. | |
| TensorShape (std::initializer_list< int64_t > il) | |
| Construct from an initializer list (e.g. | |
| int64_t | num_elements () const noexcept |
| Total number of elements (product of all dimensions). | |
| size_t | ndim () const noexcept |
| Number of dimensions. | |
| bool | is_scalar () const noexcept |
| True if this is a scalar (no dimensions, or a single dimension of 1). | |
| bool | is_vector () const noexcept |
| True if this is a 1D vector. | |
| bool | is_matrix () const noexcept |
| True if this is a 2D matrix. | |
| bool | operator== (const TensorShape &other) const |
| Equality comparison (element-wise dimension match). | |
| bool | operator!= (const TensorShape &other) const |
| Inequality comparison. | |
Public Attributes | |
| std::vector< int64_t > | dims |
| Dimension sizes (e.g. {32, 768} for a 32x768 matrix) | |
Describes the shape of a tensor as a vector of dimension sizes.
Examples: {} — scalar {100} — 1D vector of 100 elements {32, 768} — 2D matrix (32 rows, 768 columns) {4,3,3} — 3D tensor (e.g. batch of 3x3 matrices)
Definition at line 207 of file tensor_bridge.hpp.
|
default |
Default constructor: scalar shape (empty dims).
|
inlineexplicit |
Construct from a vector of dimensions.
| d | Dimension sizes. |
Definition at line 215 of file tensor_bridge.hpp.
|
inline |
Construct from an initializer list (e.g.
TensorShape{100} for 1D, TensorShape{32, 768} for 2D).
TensorShape{n}, not TensorShape{{n}}. Definition at line 219 of file tensor_bridge.hpp.
|
inlinenoexcept |
True if this is a 2D matrix.
Definition at line 246 of file tensor_bridge.hpp.
|
inlinenoexcept |
True if this is a scalar (no dimensions, or a single dimension of 1).
Definition at line 238 of file tensor_bridge.hpp.
|
inlinenoexcept |
True if this is a 1D vector.
Definition at line 243 of file tensor_bridge.hpp.
|
inlinenoexcept |
Number of dimensions.
Definition at line 235 of file tensor_bridge.hpp.
|
inlinenoexcept |
Total number of elements (product of all dimensions).
Returns 1 for a scalar (empty dims), consistent with ML frameworks.
Definition at line 223 of file tensor_bridge.hpp.
|
inline |
Inequality comparison.
Definition at line 254 of file tensor_bridge.hpp.
|
inline |
Equality comparison (element-wise dimension match).
Definition at line 249 of file tensor_bridge.hpp.
| std::vector<int64_t> signet::forge::TensorShape::dims |
Dimension sizes (e.g. {32, 768} for a 32x768 matrix)
Definition at line 208 of file tensor_bridge.hpp.