class
SushiAI::Shape
Represents tensor extents as a fixed-capacity value type.
- Declared in
include/SushiAI/core/shape.hpp
Public member functions
constexpr Shape() noexcept=defaultConstructs the rank-0 (scalar) shape.
Shape(std::initializer_list< int64_t > dims)Constructs from an extent list, e.g.
Shape{batch, features}.
Parameters
dimsThe extent of each dimension, outermost first.
Exceptions
ErrorIf the rank exceeds MAX_RANK or any extent is not positive.
explicit Shape(SushiRuntime::span< const int64_t > dims)Constructs extents from a runtime span.
Parameters
dimsThe extent of each dimension, outermost first.
Exceptions
ErrorIf the rank exceeds MAX_RANK or any extent is not positive.
constexpr int32_t rank() const noexceptThe number of dimensions; 0 for a scalar.
int64_t dim(int32_t index) constThe extent of one dimension.
Parameters
indexDimension index; negative counts from the innermost.
Returns
The extent at index.
Exceptions
ErrorIf
indexdoes not name a dimension of this shape.
constexpr int64_t operator[](int32_t index) const noexceptUnchecked extent access, for hot paths that have already validated.
constexpr int64_t num_elements() const noexceptThe total element count; 1 for a scalar, never zero.
constexpr const int64_t * data() const noexceptThe extents as a contiguous span, for handing to SushiBLAS.
std::string to_string() constA bracketed rendering such as "[64, 784]", for error messages.
Returns
A freshly built string; not cached.
constexpr std::uint64_t hash() const noexceptComputes an FNV-1a hash over rank and extents.
Returns
The 64-bit hash value.

