TensorConstraint Struct
Declarative tensor contract — describes the shape/dtype/device/format a tensor must satisfy. More...
Declaration
Included Headers
Public Member Functions Index
| bool | matches (const Tensor &t) const |
|
Returns true if t satisfies every non-empty constraint in this spec. More... | |
Public Member Attributes Index
| std::vector< simaai::neat::TensorDType > | dtypes |
|
Acceptable dtypes (empty = any). More... | |
| int | rank = -1 |
|
Required rank (-1 = any). More... | |
| std::vector< int64_t > | shape |
|
Required shape; -1 in any position means dynamic. More... | |
| std::optional< Device > | device |
|
Required device (empty = any). More... | |
| std::vector< Device > | allowed_devices |
|
Acceptable devices (empty = any). More... | |
| std::optional< Device > | preferred_device |
|
Preferred device for placement (informational). More... | |
| std::optional< ImageSpec::PixelFormat > | image_format |
|
Required image pixel format (only meaningful for image tensors). More... | |
| std::vector< Segment > | required_segments |
|
Exact required memory-segment layout (advanced). More... | |
| std::vector< std::string > | required_segment_names |
|
Required memory-segment names (must all be present). More... | |
| bool | allow_composite = true |
|
If false, reject composite (multi-plane) tensors like NV12. More... | |
Description
Declarative tensor contract — describes the shape/dtype/device/format a tensor must satisfy.
Used by Model::input_specs()/output_specs() to advertise what the model expects/produces, and by validation code to verify a tensor meets the contract via matches(). Empty fields mean "no constraint on this dimension." Use -1 in shape for dynamic axes.
Definition at line 44 of file TensorSpec.h.
Public Member Functions
matches()
| inline |
Returns true if t satisfies every non-empty constraint in this spec.
Empty fields are skipped (treated as "no constraint"). Useful for inline validation in application code and as the underlying check used by built-in contracts.
Definition at line 65 of file TensorSpec.h.
Public Member Attributes
allow_composite
|
If false, reject composite (multi-plane) tensors like NV12.
Definition at line 57 of file TensorSpec.h.